PDA

View Full Version : Origin of Texture Image Data



skynet
01-17-2005, 05:26 AM
Please excuse this stupid question, but I want to be absolutely sure on this...
When specifying a texture image (and/or any other image data in opengl?) with glTexImage2D, to which texel does the image-pointer refer:
is it the lower left texel (texture coordinates 0,0) or
is it the upper left texel (texture coordinate 0,1) ?

Relic
01-17-2005, 08:02 AM
OpenGL coordinates are lower left origin. The data of the first texel is at texture coordinate (0.0, 0.0) if the texture matrix is identity. Mind, that coordinate is the lower left corner of the lower left texel.
TGA images are normally stored bottom up, so they load nicely with glTexImage2D.

skynet
01-17-2005, 01:13 PM
thanks. This means I did that wrong for years now :-| I was flipping image data _and_ y-texcoords, so I didnīt really notice - but always had a gut feeling that something was wrong.