147's picture

Initialization of OpenGL without Window

I hope I make no mistake in asking this question, if please say and I will remember it for the future.
I want to use OpenGL for image processing and computer vision, and therefore I use OpenTK.
The problem I have, is that I have to create a Context, but I have no windows?
How can I initialize a context without having a window?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
lid6j86's picture

I'm not sure I understand what you are looking to do

golkeeper's picture

Theoretically, there is one way: http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_surfaceless_c...

Practically, it is only available under Linux with Mesa drivers, since IHVs rarely bother themselves with implementing EGL in their drivers, not to mention EGL extensions.
It will be easier to make hidden window of any kind to workaround this, or destroy window right after context creation.

147's picture

@ lid6j86 I want to use OpenGL for a Image processing library and I think from the Point of programming a class library shouldn't create a window.
Perhaps it is a Little bit of Topic, but would OpenCL be a good alternative? Can I send a Picture to the GPU with OpenCL and process it?

golkeeper's picture

Yes you can. But I'd suggest you to take a look at opengl 4.3 compute shaders, it's simpler and suited exactly to solve image processing tasks.

147's picture

Can ComputeShaders be used without initialization of a device? And are ComputeShaders allready implemented in OpenTK, and is there a Little good tutorial about them?
And a question which may also interesting.
Is it possible to Transfer a Image to the GPU with OpenCL so that it can be used by DirectX or OpenGL?

golkeeper's picture
Quote:

Can ComputeShaders be used without initialization of a device?

No, you still need window to get OpenGL context.

Quote:

And are ComputeShaders allready implemented in OpenTK, and is there a Little good tutorial about them?

Probably not, AFAIK OpenTK does not support OpenGL4.3.

Quote:

Is it possible to Transfer a Image to the GPU with OpenCL so that it can be used by DirectX or OpenGL?

You can share resources (incl images stored in GPU memory) between OpenCL and OpenGL. If your IHV is Nvidia, you may read/write DirectX resources from OpenGL via their DirectX interop OpenGL extension.