LWJGL Forum

Programming => OpenGL => Topic started by: smith on August 26, 2010, 00:18:06

Title: Headless Rendering
Post by: smith on August 26, 2010, 00:18:06
Is it possible to use OpenGL to render without creating a Display. Pbuffers don't seem to work for me, when I try glReadPixels I get 1282 (invalid operation) errors. I am using Ubuntu and NVidia's drivers and reading using:

GL11.glReadPixels(0, 0, 800, 600, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, byteBuffer);

A HeadlessDisplay class that efficiently updates a Java2D BufferedImage (or even a ByteBuffer) would be a pretty cool addition to LWJGL.



Title: Re: Headless Rendering
Post by: Estraven on September 10, 2010, 05:09:58
Hi,

I agree, I indeed had the same problem,

I worked it around this by creating a very small AWTGLCanvas outside my JFrame, and then used only FBOs.

But you have to open a JFrame at some point.

Estraven
Title: Re: Headless Rendering
Post by: smith on October 18, 2010, 22:01:00
I finally managed to make the issue go away. After much trial and error the PixelFormat that is used to create the pBuffer seems to be the issue. The default constructor doesn't require depth or stencil buffers and for some reason this causes a Invalid Operation when trying to readPixels(). Changing to an 8,8,1 PixelFormat fixed the issue.