Original Post
Hi all,
I am trying to read the frame buffer on each call to my rendering function. I use the following line of code:
glReadBuffer(GL_BACK);
glReadPixels(0, 0, 500, 500, GL_RGB, GL_INT, &pBits);
However, as soon as the call to glReadPixels is reached the program terminates. Can anyone suggest why or what i am doing wrong. I have included the code at the end.
Thanks
void display(void)
{
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
setCam();
displayGrid();
glFlush();
glutSwapBuffers();
//read the pixels from the buffer
printf("Reading Pixel Values...\n");
glReadBuffer(GL_BACK);
glReadPixels(0, 0, 500, 500, GL_RGB, GL_INT, &pBits);
}
