PDA

View Full Version : Problems from TEXTURE_2D to TEXTURE_RECTANGULAR



EpSiLoN
04-22-2009, 03:59 PM
I need to compute a TEXTURE_2D with one 8-bit component by using a one component 32-bit TEXTURE_RECTANGULAR_ARB. Then, my first step is to copy the content of TEXTURE_2D into a framebuffer created with a TEXTURE_RECTANGULAR_ARB (GL_FLOAT_R32_NV).

I copy the TEXTURE_2D using this code:

glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texImage);
glBegin(GL_QUADS);
glTexCoord2i(0, 0); glVertex3i(0, 0, 0);
glTexCoord2i(1, 0); glVertex3i(512, 0, 0);
glTexCoord2i(1, 1); glVertex3i(512, 512, 0);
glTexCoord2i(0, 1); glVertex3i(0, 512, 0);
glEnd();


I don't understand why the content of the fbo at the end of this copy is different from the original TEXTURE_2D. Seems that the 8-bit values are changed when they are transferd to 32-bit framebuffer. Is it possible? Any idea?