PDA

View Full Version : GL_TEXTURE_RECTANGLE_NV and GL_TEXTURE_2D



iris_raj
05-16-2007, 01:12 AM
Dear Opengl Programmers,

When to use GL_TEXTURE_RECTANGLE_NV and How different it is from GL_TEXTURE_2D.

(I am still using opengl 1.2 (red book).
I am slowly shifting higher versions
I have never programmed using ARB extensions and GLSL.)


Thanks in advance
RAJESH.R

Zengar
05-16-2007, 02:03 AM
The main difference are texture coordinates. The usual textures accept coordinates in range [0..1, 0..1], where rectangle textures are [0..w, 0..h] - w is width, h is height. Basically you use then just like usual textures, but instead of using the GL_TEXTURE_2D texture target, you use GL_TEXTURE_RECTANGLE_NV (upload data with glTexImage2D, enable the texture etc.) Don't forget that rectangle textures have no mipmaps! Forr deeper understanding, refer to the extensions specs.

P.S. You should post questions like this in beginners forum.

Overmind
05-16-2007, 08:31 AM
The other difference is that in OpenGL <= 1.5, you can only use texture sizes that are a power of two with GL_TEXTURE_2D, while with RECT it does not matter.

Starting with OpenGL 2.0, this restriction no longer exists, so today RECTANGLE textures are not so important anymore. If I were you, I'd totally skip this extension and go straight for OpenGL 2.0.

Brolingstanz
05-16-2007, 10:34 PM
... the 2 are spelled differently ...

Iris, if you don't mind my asking, what field of science are you in?