Thursday, December 31, 2015

How do I load a texture in OpenGL where the origin of the texture(0, 0) isn't in the bottom left?


When loading a texture in OpenGL, how do I specify the origin of the data I am loading?


For example, how would I load a Targa that has it's origin at the top left instead of the bottom left of the image?



Answer



You can't, at least not directly. The origin of textures in OpenGL is the lower-left corner. You need to vertically flip your image if it doesn't match this coordinate system. So it's really an image processing problem, not an OpenGL problem.


(Alternatively, you can flip all your texture coordinates that refer to the image.)


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...