Skip to main content
GameDev.net gamedev.net
🔒 Locked

glReadPixels

Started by idinkin Oct 16, 2003 at 7:23 AM 0 replies 550+ views
Original Post
idinkin
idinkin
I get 205 for red, green and blue after I call glReadPixels although the screen is not gray... I tried to call the function before and after SwapBuffers... What do I do wrong? Here is the function: bool __declspec(dllexport) PrintScreen(CGraphController controller) { FILE *f; GLubyte *buf = new GLubyte[controller.screenWidth * controller.screenHeight * 3]; char *dimensions = new char[20]; glReadPixels(0, controller.screenHeight, controller.screenWidth, controller.screenHeight, GL_RGB, GL_UNSIGNED_BYTE, (void *)buf); if(!(f = fopen("screenie.idg", "w"))) { Log("Can not open file for writing!", __FUNCSIG__); return false; } sprintf(dimensions, "%d %d ", controller.screenWidth, controller.screenHeight); fputs(dimensions, f); fwrite(buf, controller.screenWidth * controller.screenHeight * 3, 1, f); fclose(f); }
Sometimes movement is a result of a kick in the ass!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.