OpenGL GL rendering without a window

This topic is 3911 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I am trying to create an opengl app which renders entirely to offscreen buffers and drops those buffers to textures. This part is easy, however, I can't seem to come up with a way to do this without a window. Does anyone know any way to do this? A second (and worse, IMO) issue, is that I have to do this in java, so I am working with JOGL. Whatever the trick, I need it to work with JOGL. Any thoughts? Thanks in advance.

Share on other sites
There is no such thing as GL rendering without a window.
You can however make the window invisible and render to offscreen buffer (FBO)
I don't know how you make a window invisible in Java but I'm sure it's a simple function call.

Share on other sites
Or you probably don't even need to create the FBO, just hide the window and read the data from your default framebuffer. :)

Share on other sites
Quote:
 Original post by ArexOr you probably don't even need to create the FBO, just hide the window and read the data from your default framebuffer. :)

That's called undefined behavior. It may or may not work. Even if a window is visible and a small part is hidden, the GPU might not render to it, so they invented p-buffers which were later superceded by FBO.

The pixel ownership section of the spec explains this.

Share on other sites
Quote:
 Original post by V-manThere is no such thing as GL rendering without a window.

There certainly is such a thing. For example, Mesa provides the OSMesa driver which can render to a user defined memory buffer, without a window, or any windowing code at all. Perfect for rendering intended for a purpose other than displaying on the screen in one way or another. For example, I made an experimetal application on my webserver that used Mesa and OSMesa to render an image dynamically with parameters set by submitted data and sent it back to the browser as an encoded image.

However, I doubt the Mesa/OSMesa solution is possible in the environment required by personwholives.

Share on other sites
Quote:
Original post by Brother Bob
Quote:
 Original post by V-manThere is no such thing as GL rendering without a window.

There certainly is such a thing. For example, Mesa provides the OSMesa driver which can render to a user defined memory buffer, without a window, or any windowing code at all. Perfect for rendering intended for a purpose other than displaying on the screen in one way or another. For example, I made an experimetal application on my webserver that used Mesa and OSMesa to render an image dynamically with parameters set by submitted data and sent it back to the browser as an encoded image.

However, I doubt the Mesa/OSMesa solution is possible in the environment required by personwholives.

I'm sure he is running Windows but let's consider Linux.
Is OSMesa hw accelerated on Linux?
The only thing I know is that if I install Linux, Mesa comes with it. usually version 1.2. I don't know if it is Mesa 1.2 or GL 1.2 but it runs in software so I have to install drivers.

Share on other sites
I may be wrong but my understanding is that JOGL is designed for use with either the AWT or Swing libraries, and both the awt.Frame and swing.JFame are invisible by default unless you call show() or setVisible(true).

Share on other sites
Quote:
 Original post by V-manI'm sure he is running Windows but let's consider Linux.Is OSMesa hw accelerated on Linux?

Probably not.
Quote:
 Original post by V-manThe only thing I know is that if I install Linux, Mesa comes with it. usually version 1.2. I don't know if it is Mesa 1.2 or GL 1.2 but it runs in software so I have to install drivers.

I assume the situation is similat to Windows; if you install specific drives for particular hardware, you're limited by what the driver implementes or what the hardware provides. Mesa itself though, as a software implementation, implements OpenGL 2.1.

Share on other sites
Quote:
 Original post by personwholivesI am trying to create an opengl app which renders entirely to offscreen buffers and drops those buffers to textures. This part is easy, however, I can't seem to come up with a way to do this without a window. Does anyone know any way to do this?A second (and worse, IMO) issue, is that I have to do this in java, so I am working with JOGL. Whatever the trick, I need it to work with JOGL. Any thoughts?Thanks in advance.

You mean something like this ?
GLPbuffer pBuffer;if( GLDrawableFactory.getFactory().canCreateGLPbuffer() ) {    pBuffer = GLDrawableFactory.getFactory().createGLPbuffer(glcaps,         null, texWidth, texHeight, null);    pBuffer.addGLEventListener(this);	} else {    System.out.println("The graphics card has no pbuffer support.");}// start rendering into the pBufferpBuffer.display();GL gl = pBuffer.getContext().getGL();gl.glFinish();pBuffer.getContext().destroy();

To obtain the rendered image call this in your display function:
ByteBuffer result = ...;gl.glReadPixels(0, 0, width, height, GL_RGBA, GL_FLOAT, result);

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5
JoeJ
13

• 14
• 10
• 24
• 9
• 57
• Forum Statistics

• Total Topics
632640
• Total Posts
3007615
• Who's Online (See full list)

There are no registered users currently online

×