texture mapping just draw nothing

Hi,

recently, I was learning the raycast algorithm. And use the caculated 2Dtexture to draw the image, it draw nothing.

Here is the code:
// copy from pbo to texture
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, pbo);
glBindTexture( GL_TEXTURE_2D, tex );
glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, 0 );
glBindBufferARB( GL_PIXEL_UNPACK_BUFFER_ARB, 0 );

// draw textured quad
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glTexCoord2f(1, 1); glVertex2f(0.25, 0);
glTexCoord2f(0, 1); glVertex2f(0.75, 0);
glTexCoord2f(0, 0); glVertex2f(0.75, 0.75);
glTexCoord2f(1, 0); glVertex2f(0.25, 0.75);
glEnd();

Then I replaced the pbo with a 2D array, it works. I don’t know why?

glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, checkImage);

Any idea please?

Did you set the min/mag filters prior to using the texture? It doesn’t matter from where you source your data. You’ll always have to setup the corresponding texture object correctly.

ok!
I fixed the problem. my mistake was I set the wrong parameter for glTranslatef(). The object was out of view.

Thank you for your help!