Hi,
I’m trying to use GL_TEXTURE_RECTANGLE_NV to do a background of my application.
I need to display a 1600x1200 image.
Here the code that initialize the texture:
glGenTexture (1, id);
glBindTexture (GL_TEXTURE_RECTANGLE_NV, *id);
glParameteri (GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glParameteri (GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glParameteri (GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glParameteri (GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexImage2D (GL_TEXTURE_RECTANGLE_NV, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
Next in my display function:
glClearColor (0, 0, 0, 0);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode (GL_MODELVIEW);
glPushMatrix ();
glLoadIdentity ();
glDisable (GL_DEPTH);
glEnable (GL_TEXTURE_2D);
glEnable (GL_TEXTURE_RECTANGLE_NV);
glBindTexture (GL_TEXTURE_RECTANGLE_NV, *id);
glBegin (GL_QUADS);
glTexCoord2f (0, 0);
glVertex2f (0, 0);
glTexCoord2f (1, 0);
glVertex2f (1600, 0);
glTexCoord2f (1, 1);
glVertex2f (1600, 1200);
glTexCoord2f (0, 1);
glVertex2f (0, 1200);
glEnd ();
I’m working with an orthographic projection gluOrtho2D (…);
My problem is that the image isn’t display, The background isn’t black but the color is a mixed of brown and green.
So I’ve try to test with a small texture 32x24. But the problem is the same.
Could you help me ??
Do you have examples that uses rectangular texture with GL_TEXTURE_RECTANGLE_NV ??
Thanks in advance…
Philippe ;oD