Render to Memory Location with Hidden Window

Hi,

I’ve got a program that renders a scene into a window. Then at the end of each frame I call glReadPixels to copy the scene into a pre-determined memory location.

I then have some pre-existing software, which runs full screen and as part of it reads the memory location and displays the image stored there at a rate of 30 fps. I dont have access to modify this application (hence writing the seperate application).

The problem I’m having is when the window being used to create the scene in OpenGL is covered or minimised OpenGL stops writing to the memory location and thus when the pre-existing software runs full screen the window is covered and stops updating the memory location.

I was wondering if anyone knows of a way to have OpenGL continue to render a scene when the window is covered or minimised? Is it something to do with having it render the scene to a different frame buffer from the windows default one?

Non-visible parts of a GL window are undefined, as they fail the pixel ownership test. So it does not “stops updating the memory location”, but rather “rendering does not happen at all”.

You have to render to an FBO (framebuffer object) to be sure the rendering is always working.
http://www.opengl.org/wiki/Framebuffer_Object
A tutorial :
http://www.songho.ca/opengl/gl_fbo.html

To my understanding this requires your graphics card to support OpenGL 3.0 or the OpenGL extensions. I used fbo.exe from the example in the second link to print out what version of OpenGL and what extensions my graphics card supports and its OpenGL 1.3 without the frame buffer object extensions.

Do you know of any ways to get this working without the extensions or OpenGL 3.0?

Really ? What video “hardware” do you have to struggle with, and which driver version ?

On Windows there is the PBuffers system, which allows to do offscreen rendering, but it is very clumsy to work with that. And you need WGL_ARB_pbuffer or WGL_EXT_pbuffer extension.
You can check my (very old) tests here :
http://dedebuffer.chez.com/
http://dedebuffer.chez.com/RENDER_fast_pbuffer_copytexsub.C
You don’t need the render-to-texture stuff, simply render then glReadPixels.

Its a Matrox P690 PCIe x16 with the most up to date drivers, when I run some code I found to pull out the OpenGL version and extensions it says its using OpenGL 1.3 and the Frame Buffer Object extension isn’t in the list of supported extensions.

Developments been done using NVIDIA and ATI graphics cards and the NVIDIA card continues to render and copy with the window hidden but the ATI doesn’t. I’ve not tried running the code on the Matrox graphics card yet, so thats what I will try next, but we were hoping to find a solution that wouldn’t depend on whether the graphics card looks at pixel ownership or not.

I’ll take a look into using the PBuffer but if that doesn’t seam like it will work we might just try upgrading to a graphics card that has OpenGL 3.0 (or newer) or supports the correct extensions, thanks for the help :slight_smile:

Looks like we are able to upgrade the graphics card so will be using Framebuffer Objects and using one has made the rendering to the shared memory location continue while the window is covered by another. However if we try to minimise or hide the window blank space is drawn into the shared memory location rather than the textures that should be loaded in.

I don’t have much of a clue as to why it would start drawing blank spaces other than maybe the textures are being bound to the Window’s context rather than the Framebuffer Object so when the Window is rendered in-active the Framebuffer Object can’t access the textures any more? So thought I should look into binding textures to a Framebuffer Object, however I’m having some difficulty understanding things around the use of GL_COLOR_ATTACHMENT0, do I need to manually attach each texture I want the Framebuffer to be able to use to a different attachment number?