PDA

View Full Version : WGL_TEXTURE_RECTANGLE_NV problems



anthony
03-26-2004, 08:10 AM
Hi,

I'd be very grateful if someone could tell me where I'm going wrong in trying to use non power of two dimension textures. Here is my code to setup a rectangular texture:

glGenTextures(1, &tex);
glBindTexture(WGL_TEXTURE_RECTANGLE_NV, tex);
glTexParameteri(WGL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(WGL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(WGL_TEXTURE_RECTANGLE_NV, 0, 3, xSize, ySize, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);

Later on I do some rendering and then do this:
glBindTexture(WGL_TEXTURE_RECTANGLE_NV, tex);
glCopyTexSubImage2D(WGL_TEXTURE_RECTANGLE_NV, 0, 0, 0, 0, 0, xSize, ySize);

Finally I draw a quad textured with this texture by doing:
glEnable(WGL_TEXTURE_RECTANGLE_NV);
glBindTexture(WGL_TEXTURE_RECTANGLE_NV, tex);
// draw a textured quad.

All I ever get is a white quad.
My gfx card definetly supports all this (it's a GeForce4 MX)..

Can anyone tell me what I'm doing wrong?

Many thanks!

-Anthony

roffe
03-26-2004, 08:57 AM
Try using GL_TEXTURE_RECTANGLE_NV as target instead. WGL_TEXTURE_RECTANGLE_NV is used when specifying attributes for pbuffer creation.

anthony
03-26-2004, 09:11 AM
I love you so much.
Thank you.

yooyo
03-26-2004, 02:51 PM
Originally posted by anthony:
I love you so much.
Thank you.And don't forget... Mapping coordinates in texture_rectangle_NV are (0..xres, 0..yres).

yooyo