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

glPixelRead

Started by minfg135 Jun 1, 2002 at 4:33 AM 0 replies 1.1k views
Original Post
minfg135
minfg135
How can i save an OpenGL scene as a BMP file using the glPixelRead (i.e. take a snapshot) ?
JuNC
JuNC
Create a buffer to hold your image (assuming 800x600 RGB)

unsigned char* pBuffer = new unsigned char[800*600*3];

Use glReadPixels:

glReadPixels(0,0,800,600,GL_RGB,GL_UNSIGNED_BYTE,pBuffer);


Then write a BMP file of the buffer in pBuffer, this is left as an exercise in web/tutorial searching

Topic Locked

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

Sign in to reply to this topic.