Rendering without a window

Started by
10 comments, last by Sneftel 15 years, 8 months ago
Hi to all! I've a strange question... In my current project, I use GLUT library for window management. The question is pretty simple: is possible to use OpenGL without any window, so without using the GLUT library? My only purpose is to rendering to an image, by the reading of frame buffer. So, for example, I've a simple code, in this code I call glBegin() function to drow some triangles, I read the frame buffer and then I put the data on a image. It's possibile to do this without the GLUT library, without any window, only using a simple OpenGL code? Thanks!
Advertisement
Mesa have a wonderful offscreen renderer. Basically, you allocate a memory buffer to render to, create the rendering context, do your OpenGL commands, and you have the image in the buffer for any use you like.
Quote:Original post by Brother Bob
Mesa have a wonderful offscreen renderer.

Thanks for the help! Tomorrow I try the Off-screen Rendering!
Why not just make a frameless window to render to?
If you're targetting Windows only then you could just use pbuffers directly. I imagine Mesa makes off screen rendering more portable though.
Hi!
I've tried Mesa3D offscreen-rendering and it's run correctly. But, now, I can use only the Mesa3D implementation and the rendering quality is very decreased.
Aren't possible other solutions?
Thanks!
You can create message only windows in recent versions of windows by using HWND_MESSAGE as the parent of a window. However, I don't know if these windows are sufficient to create a rendering context and initialize a framebuffer object.

http://msdn.microsoft.com/en-us/library/ms632599(VS.85).aspx
I must implement a platform indipende code...
For me, using Mesa3D, I obtain bad quality rendering because the hardware acceleration isn't used, but I don't understand because...
The rendering quality should be good. I know because I've tried it.
It offers a similar pipeline to any GPU implementation.
Of course, it is slow, because Mesa3D is not a driver.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
In which way is the quality lowered? Perhaps some hinting towards quality might help the implementation.

This topic is closed to new replies.

Advertisement