Flying_sands
10-23-2005, 02:19 AM
I want to use content in frame buffer as texture.
following code do the job:
glReadBuffer( GL_BACK);
glReadPixels(0, 0, 500, 500, GL_RGB, GL_UNSIGNED_BYTE, pPixels);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 500,
500, 0, GL_RGB, GL_UNSIGNED_BYTE, pPixels);
however, following code does not:
glReadBuffer( GL_BACK);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 500, 500);
why? I think glCopyTexSubImage2D copy frame buffer to texture.
following code do the job:
glReadBuffer( GL_BACK);
glReadPixels(0, 0, 500, 500, GL_RGB, GL_UNSIGNED_BYTE, pPixels);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 500,
500, 0, GL_RGB, GL_UNSIGNED_BYTE, pPixels);
however, following code does not:
glReadBuffer( GL_BACK);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 500, 500);
why? I think glCopyTexSubImage2D copy frame buffer to texture.