PDA

View Full Version : GL_RGBA32F_ARB



Tiberius
01-17-2006, 07:41 PM
I'm trying to learn a bit more about textures, so I can use them in GPGPU applications. I wanted to check to see if I'm using GL_RGBA32F_ARB and GL_TEXTURE_RECTANGLE_ARB correctly.

I'm attempting to populate the texture using a 1D array of size nX*nY. Since the texture has 4 floating point numbers per texel, I assume that the texture size in X should be divided by 4:

glTexImage2D( GL_TEXTURE_RECTANGLE_ARB, 0,
GL_RGBA32F_ARB,
nX/4.0, nY,
0, GL_RGBA,
GL_FLOAT, 0 );Later, I need to render a textured quad to the entire screen:

// viewport for 1:1 pixel=texture mapping
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluOrtho2D( 0.0, nX/4.0, 0.0, nY );

glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glViewport( 0, 0, nX/4.0f, nY );

/*
Code to bind textures to framebuffer
*/

// render with unnormalized texcoords
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex2f(0.0, 0.0);

glTexCoord2f(nX/4.0, 0.0);
glVertex2f(nX/4.0, 0.0);

glTexCoord2f(nX/4.0, nY);
glVertex2f(nX/4.0, nY);

glTexCoord2f(0.0, nY);
glVertex2f(0.0, nY);

glEnd();Am I on the right track?

Thanks!