PDA

View Full Version : glCopyTexImage2D error in Dual Monitor



HanWu
11-22-2010, 02:52 AM
I created an application that save the current screen with glCopyTexImage2D method and later retore the screen by output the content from the GL_READ_BUFFER to a texture, this texture will be attached to a polygon and display to the user. This method works fine in a single Monitor and running without any error, but the problem exist when I run the same application in the environment that have Dual Monitor.

The step to reproduce the problem.
1) Start the Application, and the application will always pop up in the primary monitor.
2) Move the application from the primary monitor to the secondary monitor.
3) Call the glCopyTexImage2D method to save the current screen.

What happen: The displayed polygon(with texture attach to it) always shows a black color, seems like nothing is been save. But if you move the application back to the primary monitor and maximize the window, after this if you call the glCopyTexImage2D again, you are able to save and display the polygon without any problem. It seems like something to do with the Dual Monitor, can anyone help me to fix this problem? Thanks in advance.

ZbuffeR
11-22-2010, 03:21 AM
If you want robust results from glReadPixels, it is better to work on an FBO.
For example, if the GL window is partially covered or minimized, glReadPixels from normal framebuffer returns garbage results.
On the contrary, glReadPixels from the FBO should always be correct.
http://www.opengl.org/wiki/Framebuffer_Object
http://www.opengl.org/wiki/GL_EXT_framebuffer_object
http://www.gamedev.net/reference/programming/features/fbo1/

HanWu
11-22-2010, 03:26 AM
What you say is right, the covered or minimized part will not be saved but the problem is not every graphic card support FBO especially those on-board graphic card such as Intel 965, 945. By the way, can you explain the problem that I describe previously, why the glCopyTexImage2D not able to save the pixel correctly when running at the secondary Monitor? Thanks!

ZbuffeR
11-22-2010, 03:28 AM
I do not know why, as multi display support is very different depending on your video card, drivers, and OS version.

What are yours, by the way ?

HanWu
11-22-2010, 03:37 AM
Intel core two dual 2.33gHz.
Graphic card: NVdia 8400GS.
Driver : not remember(Company PC, about 2 year ago)
OS : Window XP professional 32 bit.