Hi all,
I’m a beginner in OpenGL and I’m using it to display 2d image from a camera.
I created a tecture 2d with the size power of 2 so it’s always bigger than my buffer that is 384x288.
When drawing I’d like to see only the image from the camera but I get all the texture.
How can I “crop” it to see only the portion of interest?
You have to reduce the texture coordinates. The range [0.0, 1.0] always gives the whole texture.
I assume the texture size is 512, the image you want to display is 384 pixels wide and it starts at pixel 0. Then you have to use texture coordinates from 0 to 384/512.
Texture rectangles don’t work with mipmapping, but if you don’t need it, it’s propably the best method. They should be supported on nearly every card out there. I think they are supported on ATI since 7000 and on nVidia on every GeForce card.