![]() |
|
[a5] Can shaders be created and used without creating a display? |
Mark Oates
Member #1,146
March 2001
![]() |
Looking at some code, I see Allegro's shaders are prepared by using the ALLEGRO_PROGRAMMABLE_PIPELINE flag for al_set_new_display_flags. I don't have enough understanding of the GL APIs below the Allegro layer, but based on this design it seems that displays are a required dependency? Is this a limitation of Allegro (or, should I say, the "median" of GL APIs that Allegro wraps), or is there a way to access shader rendering without creating a display? |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
That's just the way it works. To create a shader, you need an OpenGL context. To create an OpenGL context, you need a display. Allegro doesn't support custom GL contexts without a display. You're more than welcome to set it all up yourself. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Erin Maus
Member #7,537
July 2006
![]() |
Do you want to render using shaders without creating a physical window on the screen? I.e., have a completely off-screen GL context? That is possible but you might have to drop down to lower level platform-specific APIs for that, or use platform-specific APIs to hide the Allegro window after creation. --- |
Mark Oates
Member #1,146
March 2001
![]() |
Erin Maus said: Do you want to render using shaders without creating a physical window on the screen? I.e., have a completely off-screen GL context? Yea, in this special narrow case that's what I'm looking for. It's not critical, but would make for cleaner testing. Another thing I'm creepin' for is the ability to spawn new displays underneath the topmost window (so as not so take focus from the current window). |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Mark Oates said:
Erin Maus said: Do you want to render using shaders without creating a physical window on the screen? I.e., have a completely off-screen GL context? Yea, in this special narrow case that's what I'm looking for. It's not critical, but would make for cleaner testing. Another thing I'm creepin' for is the ability to spawn new displays underneath the topmost window (so as not so take focus from the current window). Just use al_set_new_display_position : al_set_new_display_position(-10000,-10000);
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
MikiZX
Member #17,092
June 2019
|
On Windows you could use: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow?redirectedfrom=MSDN to hide a window (though I only assume the OpenGL context remains active - I think it should). On Linux or OSX I am not sure - some Google-ing gives this: https://stackoverflow.com/questions/26836430/hiding-active-window-in-linux |
Chris Katko
Member #1,881
January 2002
![]() |
Mark Oates said: Yea, in this special narrow case that's what I'm looking for. It's not critical, but would make for cleaner testing. I mean, what would rendering mean, without a device context? If the device is in 8 bit color, it renders in 8-bit color. 24-bit, 32-bit. 800x600, 1280x720, ... RGB vs BGR, as well as setting giving the user all the relevant function pointers. If there's no device (even a "virtual" one)... that'd be like drawing using pencils with no piece of paper. What does "drawing a beautiful girl" mean when you're just waving pencils in the air? Now, I've read you can use the desktop window as a kind of root context "as long as you're sure to not draw to it". The alternative (listed above) is to simply hide the window. That seems to be the most common situation. -----sig: |
Mark Oates
Member #1,146
March 2001
![]() |
The behaviour I'm curious about is the ability to load up a Shader and render with it, without having to create a window instance with the OS. This is similar to being able to draw to a software-created ALLEGRO_BITMAP, without having to create a display. I'd like to draw to it with a Shader on, and then read from the bitmap (pluck a pixel or two) to check it rendered as expected, or possibly save the bitmap to a file on the filesystem. The other concern, having a window that I do want created to spawn underneath the current focused window, is a different thing altogether. It solves a different problem, which is that the created windows interrupt the current focus. That means I don't want to create-and-then-hide, because that will still break the focus. Here, I'm looking for something like a new display flag to spawn underneath the current window, or at the bottom of the window drawing order. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
You need an OpenGL context to render. Period. Offscreen or not. As for spawning underneath, the only way to do that is to have a TOPMOST window on top of everything. Or edit Allegro not to show the window upon creation. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
MikiZX
Member #17,092
June 2019
|
I am not sure how much this will help... Also, for starting your application without it taking focus, possibly running your app/launcher app as a service could be a solution? |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Use a transparent fullscreen window for your top window using ALLEGRO_FULLSCREEN_WINDOW . Call a few DWMEnableBlurBehind is your friend. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|