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?