ChinaShrimp
09-06-2004, 06:37 PM
Hi,
I happened to a question about using glCopyTexImage().
First, I draw a texture into the framebuffer, and read the data from the framebuffer into memory using glReadPixels(). It's all ok.
But now I want to copy the content in the framebuffer to a texture using glCopyTexImage(). To my surprise, I found all the values in the texture equal to 0. I don't know why? The following is some codes in my project:
glBindTexture(GL_TEXTURE_2D, textureMatrix[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 1, g_nProjectionSize, g_nProjectionSize, 0, GL_LUMINANCE, GL_FLOAT, NULL);
glBindTexture(GL_TEXTURE_2D, textureMatrix[i]);
glCopyTexImage2D(GL_TEXTURE_2D, 0,GL_LUMINANCE, nLeftBorder, nRightBorder, g_nProjectionSize, g_nProjectionSize, 0);I'll appreciated any suggestios:)
Thank you!
I happened to a question about using glCopyTexImage().
First, I draw a texture into the framebuffer, and read the data from the framebuffer into memory using glReadPixels(). It's all ok.
But now I want to copy the content in the framebuffer to a texture using glCopyTexImage(). To my surprise, I found all the values in the texture equal to 0. I don't know why? The following is some codes in my project:
glBindTexture(GL_TEXTURE_2D, textureMatrix[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 1, g_nProjectionSize, g_nProjectionSize, 0, GL_LUMINANCE, GL_FLOAT, NULL);
glBindTexture(GL_TEXTURE_2D, textureMatrix[i]);
glCopyTexImage2D(GL_TEXTURE_2D, 0,GL_LUMINANCE, nLeftBorder, nRightBorder, g_nProjectionSize, g_nProjectionSize, 0);I'll appreciated any suggestios:)
Thank you!