[SDL] SDL_image to OpenGL Texture loading

Mathew Byrne mathewbyrne at gmail.com
Mon Jun 26 23:44:01 PDT 2006


Martin Storsjö <martin <at> martin.st> writes:
> 
> Umm, this convention doesn't apply to textures, AFAIK.
>
> 
> In texture space, (0,0) is the "beginning" of the texture data fed to 
> glTexImage. (x,0) always belongs to the first row of the texture data, 
> (x,1) belongs to the second row, etc. glTexImage doesn't have any notion 
> of directions as in up/down/left/right or or upper/lower corners. It only 
> is given texture data as a sequence, and the only sensible thing to do 
> with that is to map (0,0) to the beginning of that data.
> 
> Indeed, this seems counter-intuitive if you map a rectangle with e.g. 
> corners in (0,0), (1,0), (1,1), (1,0) and have texture coordinates set to 
> the same as their vertex coordinates.
> 

In all the 3d packages I've worked with, and AFAIK with general OpenGL,
this convention is used. I tend to like it as it matches up nicely with
the default OpenGL coordinate system and cartesian coordinates in general.
In an imaging sense it seems counter-intuitive however in a 3-dimensional
scene, it's often neater and more consistent to use the bottom-left texture
coord conventions.

Thanks for the info, you've put me on the right track.





More information about the SDL mailing list