PDA

View Full Version : I hate Texture Co-ordinates



glBomb
04-26-2007, 08:06 AM
Is there a way to avoid using texture co-ordinates in openGL. My game is 2D like age of empires using textured quads, and i want to blit from an image using textures and texture co-ords. But i would like to use the actual pixel locations.

eg if an image occupies from 0,0 to 10,10 of a texture of size 20 by 20 then i want to use 0 and 10 when specifying texture co-ordinates while texturing quads. Not 0 and 0.5....

..thanks

Korval
04-26-2007, 11:11 AM
Is there a way to avoid using texture co-ordinates in openGL.If it bothers you that much, why not just have a simple class in your game that understands where the images you want to blit are and automatically generates the right texture coordinates for them? Then it's hidden from you and you never have to look at it.

However, if you don't like it, you can always generate an appropriate texture matrix to scale from image-space to normalized-texture coordinate space.

predaeus
04-26-2007, 11:56 AM
I think if you prefer [0 20] instead of [0 1] then you could also take a look at the GL_TEXTURE_RECTANGLE_ARB extension which requires texture coordinates to be set in the [0 textureWidth] space and not the normalized [0 1] space.