Reputation: 567
I'm trying to read pixels from GLX context. here is how I'm creating context
int Attributes[] =
{
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DOUBLEBUFFER, GL_TRUE,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
None
};
visual = glXChooseVisual(display,
DefaultScreen(display),
Attributes);
if (visual == NULL)
{
return -1;
}
glxContext = glXCreateContext(display, visual, NULL, GL_TRUE);
XLockDisplay(displayGLX_);
int result = glXMakeCurrent(display, windowHandle, glxContext);
XInitThreads();
then I'm rendering simple triangle and I want to read that buffer by glReadPixels. Is there any posibility to do it?
glReadBuffer(GL_BACK);
glXSwapBuffers(display, windowHandle);
and then I'm calling
glReadPixels
Upvotes: 2
Views: 296
Reputation: 521
Dont swap 1st, you read from the BACK buffer, so glReadPixels before swap...
Upvotes: 3