Headless Rendering

I posted this question on the lwjgl forum but due to the server meltdown I thought I would ask it over here:


			Pbuffer pbuffer = new Pbuffer(800,600,new PixelFormat(),null,null);
			pbuffer.makeCurrent();
			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
			ByteBuffer bytes = ByteBuffer.allocateDirect(800*600*3);
			GL11.glReadPixels(0,0,800,600,GL11.GL_RGB,GL11.GL_UNSIGNED_BYTE,bytes);

Why does this code give me an OpenGL 1282 (invalid opperation) error?
This is on Ubuntu Linux using the latest NVidia drivers.

i don’t know all that much, but maybe you need to put some parameters into that new PixelFormat.

headless rendering? if I remember correctly it isn’t supported by lwjgl, could be wrong though.

Initial post is almost 3 months old guys :slight_smile:

He solved the issue and posted it on the LWJGL forum:
http://lwjgl.org/forum/index.php/topic,3439.0.html

[quote]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.
[/quote]
Mike