End Google Ads 201810 - BS.net 01 --> Facing an uphill batte against OpenGL vs. Vista/Win7 ...

Seems we cannot use GDI to BitBlt to do a screenshot when Aero is turned on.

Reading a lot on the web (opengl.org,gamedev.net, ...) about this, it looks like I need to use glReadPixels to get the RGB(A) values from the OpenGL buffer.

The issue is that I'm not certain how to transfer the resulting pixel array ( RGB(A) ) to something that Windows can use.


glPushAttrib(GL_PIXEL_MODE_BIT);
glReadBuffer(GL_FRONT);

glFlush();
glFinish();

unsigned char *glBuffer = new unsigned char [width*height*4];
ASSERT( glBuffer) ;

glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, glBuffer);

/// transmorgrify because of different format between opengl and windows
unsigned char* Buffer = new unsigned char [width*height*3];
unsigned char* ptmp = Buffer;
unsigned char* pbuffer = glBuffer;
for (int j=0; j<span class="code-keyword">