LWJGL Forum

Programming => OpenGL => Topic started by: Kai on July 08, 2008, 21:17:47

Title: OpenGL context without created Window
Post by: Kai on July 08, 2008, 21:17:47
Hi,

is it possible to initialize an OpenGL context without creating a window?

I want to use GPGPU with LWJGL using glsl shaders and would only render to FrameBufferObjects. Thus, I do not need a created window that pops up and must be Display.update()-d.

Regards,
Kai
Title: Re: OpenGL context without created Window
Post by: Matzon on July 08, 2008, 22:02:04
can you use pbuffers ?
Title: Re: OpenGL context without created Window
Post by: Kai on July 09, 2008, 05:47:13
Well, sure, I could use pbuffers, but aren't they only available under MS Windows?
Title: Re: OpenGL context without created Window
Post by: Matzon on July 09, 2008, 07:05:19
no? - that would be a surprise to me at least!
Title: Re: OpenGL context without created Window
Post by: Kai on July 09, 2008, 08:39:05
Thanks for your replies!

While searching for some examples I stumpled over "http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/opengl/pbuffervsfbo" which mentions some issues with pbuffers under Linux.

Nevertheless, I will give it a try with pbuffers.
Title: Re: OpenGL context without created Window
Post by: Kai on July 09, 2008, 21:10:42
PBuffers works perfectly in conjunction with FrameBuffer objects!

for those interested in my solution:

I saw some articles, especially on http://www.gpgpu.org/ which either uses pbuffer XOR uses FrameBuffer objects, but not both.
But I realized that pbuffers are NOT primarily a technique to render to a texture; pbuffers just give the user the ability to create an OpenGL context (with a render buffer) that can be rendered to without the need of creating a window handle.
Realizing that, I created myself a PBuffer and because copying render buffer contents to a texture (using glCopyTexSubImage2D) and afterwards reading the contents of that texture back into RAM (using glGetTexImage) would be too slow, I also used FrameBufferObjects on top of this, which saved me the "copy render buffer to texture" part.

Greetings,
Kai