Open GL context without creating a window

BlitzMax Forums/OpenGL Module/Open GL context without creating a window

beanage(Posted 2009) [#1]
Hey Guys,

2 questions:

#0: how can I use OpenGl render functionality in a process without creating a visible Graphics window (all rendering goes through Fbos)? any ideas?

#1: i render to an fbo'ed image, with a shader that knows this particular image as a sampler2d. is this critical in any way?

thank you,

BeAnAge


Jim Teeuwen(Posted 2009) [#2]
No idea about #1, but as far as #0 is concerned I doubt you can. At the lowest level, OpenGL attaches itself to your GPU for all it's rendering.

Not sure about rendering in software mode though. Since this mode does not touch the GPU, I suppose it could be possible to have everything handled strictly in memory. Software mode is slow though and will not support any fancy things like shaders.

You could always try to use some platform code to manually hide any windows that may be created from both the desktop and the task bar. If you want to do this before the window is actually created/opened, you'll probably have to write your own window management code, or hack around in the modules which normally do this for you. Of course the latter option comes at your own risk of breaking any other projects you may have which rely on these modules.

edit: A quick google session reveals you could possibly attach the opengl context to an existing device context like the desktop.

http://stackoverflow.com/questions/714707/opengl-context-without-opening-a-window-wglmakecurrent-fails-with-hdc-and-hglrc

Not sure how portable or stable this is though. Also, randomly drawing stuff to the desktop could have other unforeseen problems. I personally wouldn't touch this option with a ten foot pole.

When all is said and done, I'd opt for the simple cheat of hiding the window. it's fast, clean and easy :p


beanage(Posted 2009) [#3]
Thank you for your research.
I also thought about simply hiding the window, but wanted to make sure theres no ""legal"" workaround.
Attaching it to the desktop context wont work for me because of platform-dependencie problems (wglMakeCurrent()..).

Any ideas about #0?

Regarts,

BeAnAge


ImaginaryHuman(Posted 2009) [#4]
Make a hidden maxgui window with a canvas?


xlsior(Posted 2009) [#5]
Make a hidden maxgui window with a canvas?


That would be my thought to, especially since you can set it hidden upon creation, so it won't even flash something by.


beanage(Posted 2009) [#6]
Hey, good hint! Thats exactly what i will do.