2D Texture Problem
I have just started using Open GL and want to write a little 2D sprite kinda thing. I have done most of this and can load a texture that will happily be on a quad. Can someone tell me how to load in a texture and only use part of it for my quad?? So I can load in a number of frames as one texture and then use each rectangle area as a single frame hence giving me Animation on my quad with the minimum textures loaded in????
That is controlled by the texCoord function. Right now you are putting values of (0,0)(0, 1)(1, 0)and (1,1) right? Just an example, if you have it divided into four frames then the lower left would use the four corners(0,0)(0.5,0)(0.5,0.5)and(0,0.5). Use this to apply for the other frames. It also applies if you have it divided into 100by100 frames then(0,0)(0.01,0.01)etc... That should solve your problem.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement