Capture OpenGL window screen in Real-time ?

Started by
1 comment, last by luckyyyyyy 12 years, 5 months ago
Hello.

I have spent too much time on this topic but got failed..

actually I just want to capture the screen shoot of OpenGL window in real time rendering. I mean to say in Display() function of OpenGL.
I tried with glReadPixels but I every time got the full black screen.

for example:

if(SKIP_FRAMES == 40)
{
CaptureScreenShoot(CapImg1, 512, 512);
glBindTexture(GL_TEXTURE_2D, BMPimageTexture[0]);
Sleep(1000);
}
if(SKIP_FRAMES == 60)
{
CaptureScreenShoot(CapImg2, 512, 512);
glBindTexture(GL_TEXTURE_2D, BMPimageTexture[1]);
Sleep(1000);
}
so on.......................


this method is not working... I got full black screen. But when I capture the screen using manual method for example by pressing key in Keyboard(unsigned char key, int x, int y) function... it works,,
but in Display() function it does not work.. I mean in real-time. why is it so ? what should i do for capturing the screen in real-time. already hanging around many libraries but couldn't find any ?
Advertisement
You arent being very clear. Are you using glReadPixels or glBindTexture?
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
yea i am talking about glReadPixel

anyways the problem has been solved. the mistake was, I was capturing the image before the projection of texture. after disabling the texture, now i am able to capture the screens in the real-time.
Thanks

This topic is closed to new replies.

Advertisement