How to display only part of texture
I'm porting my engine's renderer from SDL to OpenGL. In SDL, I would use srcrect in the SDL_BlitSurface function and could specify what part of image to blit. How would I do this with OpenGL? I only want to have one texture for all of the tiles.
You'll just need to change the texture coords you pass ogl. For example if you have a textured quad and you want to display one quarter of the texture you could have the texture coords for the 4 verts of the quad run from 0 to 0.5. You'll want to look at glTexCoord and glTexCoordPointer for details.
Quote:Original post by Nemesis2k2
glTexSubImage2D should do what you want.
EDIT: Description from MSDN.
Thanks, that was exactly what I wanted. Rating++
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement