PDA

View Full Version : standard sized 2D images on OpenGL



CeccOman
12-15-2003, 11:35 PM
Hi all,

I'm trying to display some standard sized (i.e. 640x480, 800x600, 1024x768) images into an OpenGL scene.
What I'm doing at the moment is to shrink the image to some 512x512 in the painting tool, then display a quad at full screensize under Ortho.
It doesn't look a nice way to achieve my goal, any hints?

Thanks!

Tzupy
12-16-2003, 12:19 AM
Hi,
You can use two approches:
1) tile your image into textures of 256x256 or 512x512, pad the undefined space on the edges with the background color and display the resulted textures on quads.
2) use the GL_TEXTURE_RECTANGLE_EXT (it's the same as GL_TEXTURE_RECTANGLE_NV, code 0x84F5) to have a texture of the desired width and height. Pay attention that the texture coordinates are going to be in texture space now, not in [0..1]. And there is an upper limit for the texture size, but it's 2048 or 4096 on recent nVidia and Ati cards.
You might want to take a look in the advanced section, where I started a topic on the performance drop when using thousands of textures to do this kind of job.

CeccOman
12-16-2003, 04:57 AM
Thank you! I will have a look for sure!