View Full Version : Texture Sizing

Jack Dingler

05-01-2007, 08:29 AM

In my application, I currently have textures displaying in 3d space. The textures contain labelling and size information for objects.

I need these textures to be normalized so that they appear to have the same screen dimensions no matter how far away from the camera they are. but I need them to remain in 3d space so that they are clipped by objects and their transparencies work properly.

Is there an easy way to do this in OpenGL?

Jack Dingler

05-01-2007, 10:12 AM

If there's no easy answer to my question then...

Are the params for the GL_PROJECTION_MATRIX documented anywhere?

For my texture, I have the coords for the centerpoint. If need be, I can calculate the four points for the corner, once I know a bit about the projection space.

Korval

05-01-2007, 10:47 AM

Are the params for the GL_PROJECTION_MATRIX documented anywhere?GL_PROJECTION_MATRIX isn't a function, so it doesn't have parameters.

However, the OpenGL "SDK" (http://www.opengl.org/sdk/) has documentation on the matrix functions that you use to manipulate the matrix that GL_PROJECTION_MATRIX represents. gluPerspective, glFrustum, and the like.

Zengar

05-01-2007, 11:00 AM

Texture is just an image, it will be projected onto a polygon you draw. What you probably want is to use the orthographic projection (glOrtho) for drawing you labels.

Jack Dingler

05-01-2007, 11:03 AM

Ok, I wasn't clear in that last question.

Given,

GLdouble projection[16];

glGetDoublev(GL_PROJECTION_MATRIX, projection);

Can any of these 16 numbers in the matrix, is there information I can use in order to calculate the location of point in the model, relative to the field of view? What do these 16 numbers represent?

I need to take a center point and find four corners of a rectangle, using an algorithm that will disply as exactly the same size on the screen, no matter what position in space I choose to place the rectangle.

So in effect, rectangles further from the camera need to be larger than rectangles up close. Also, I can't have any distortions or rotations.

Jack Dingler

05-01-2007, 11:07 AM

Thanks Zengar.

This is a 2D texture. For instance from the function glTexImage2D().

It floats in space in the between dimension lines for the model. They need to be in 3D space, in case the model obscures them. We don't want labels that are behind the model to appear on top.

Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.