Stream: brlcad

Topic: OpenGL


view this post on Zulip Armin (LordOfBikes) (Jun 06 2018 at 06:34):

Think this concerns BRL-CAD too, when it's nearer the time:
https://www.anandtech.com/show/12894/apple-deprecates-opengl-across-all-oses

view this post on Zulip Sean (Jun 07 2018 at 05:17):

Think this concerns BRL-CAD too, when it's nearer the time:
https://www.anandtech.com/show/12894/apple-deprecates-opengl-across-all-oses

Yeah, I saw the infuriating announcement earlier in the week, opencl too

view this post on Zulip Sean (Jun 07 2018 at 05:18):

What I suspect will shake down in the near term is OpenGL will remain for at least 5+ years and the open source Vulkan driver's would take over from there (essentially wrapping Metal)

view this post on Zulip starseeker (Aug 24 2020 at 19:27):

@Erik How's your Linux OpenGL foo these days? I'm getting a maddening issue and I'm not sure where it's coming from...

When I do a low level MGED classic mode opengl display manager attach, I'm getting a really weird transparency effect in the window. How do I disable this?

opengl_drawing_oddness.png

view this post on Zulip starseeker (Aug 24 2020 at 19:28):

I'm sure it's at least partially due to new effects from Gnome and compositing wms and such, but as far as I know there's been no substantive change to our OpenGL drawing code in a very long time so I don't know what we're doing (or more likely not doing) to produce this result.

view this post on Zulip starseeker (Aug 24 2020 at 19:29):

(The part I REALLY don't get is that the terminal background shows through in the non-geometry areas, which would be annoying enough, but now the text is rendering on TOP of the geometry???)

view this post on Zulip starseeker (Aug 24 2020 at 20:26):

OK, it's definitely something to do with Gnome - when I switch to Fluxbox everything behaves.

view this post on Zulip starseeker (Aug 24 2020 at 20:30):

/me hasn't used fluxbox since switching to the high DPI monitor... kinda nice to be back, actually...

view this post on Zulip Erik (Aug 24 2020 at 21:54):

Um, what's the clear color alpha? Could it be that?

view this post on Zulip Erik (Aug 24 2020 at 21:55):

Heh, mate and icewm for me, lately...

view this post on Zulip starseeker (Aug 25 2020 at 01:09):

I tried flipping that from 0 to 1, didn't seem to change anything...

view this post on Zulip Sean (Aug 25 2020 at 16:45):

try finding what the blending function is set to.. https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBlendFunc.xhtml

view this post on Zulip Sean (Aug 25 2020 at 16:47):

Might need to set/call it if it's not set. Default may have changed from one mode or another, might be getting set inside Tk or getting changed in the driver by another app and needing to be reset on our end each redraw, or something like that.

view this post on Zulip Sean (Aug 25 2020 at 16:48):

looks kind of like it's GL_ONE_MINUS_DST_ALPHA

view this post on Zulip Sean (Aug 25 2020 at 16:48):

or GL_DST_COLOR, something DST-related

view this post on Zulip Sean (Aug 25 2020 at 16:49):

when it should be something else..

view this post on Zulip starseeker (Aug 25 2020 at 21:00):

HAH! Used apitrace to look at the OpenGL calls in Gnome and Fluxbox with fbserv, and they were essentially the same despite different visual outcomes (Gnome transparent, Fluxbox not.) That pointed the finger at the XVisual setup. Some hunting and a stackoverflow post pointing to an obscure corner of the XVisualInfo setup, and we're now able to filter out transparent window types!

view this post on Zulip starseeker (Aug 25 2020 at 21:01):

Must confess fixing that is intensely satisfying - that's been a thorn in the graphics side of things for years now.

view this post on Zulip Sean (Aug 25 2020 at 21:07):

Nice work

view this post on Zulip Sean (Aug 25 2020 at 21:09):

We may need to ultimately support visuals with an alpha channel (e.g., if there aren't any), in which case the other fix look like to just set the clear color, which we probably don't do but should. glClearColor(bg[R],bg[G],bg[B],1.0f);

view this post on Zulip starseeker (Aug 25 2020 at 21:11):

I tried fiddling around with that, but I couldn't seem to make a dent - it was almost like the entire window contents were being blended by the desktop's compositor.

view this post on Zulip Sean (Aug 25 2020 at 21:12):

Did you see/set the blending function? That still comes into play too.

view this post on Zulip starseeker (Aug 25 2020 at 21:13):

ogl has a transparency setting that toggles that - otherwise we don't touch it in our code as far as I can tell.

view this post on Zulip starseeker (Aug 25 2020 at 21:13):

It didn't get triggered in either fbserv invocation

view this post on Zulip Sean (Aug 25 2020 at 21:15):

that's was my point though -- we are probably not setting it correctly

view this post on Zulip starseeker (Aug 25 2020 at 21:15):

I'm not very good at figuring out which OpenGL state transitions and functions need to go where in the dm drawing cycle to achieve specific effects - if we ever really have to drill down on that I'm going to have to set up a stand-alone drawing app and do a lot of fiddling

view this post on Zulip Sean (Aug 25 2020 at 21:15):

probably should be something like glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

view this post on Zulip Sean (Aug 25 2020 at 21:15):

before the draw

view this post on Zulip Sean (Aug 25 2020 at 21:15):

assuming GL_BLEND mode is being enabled

view this post on Zulip starseeker (Aug 25 2020 at 21:15):

Really hoping we can just move to a higher level drawing API and ditch the whole mess...

view this post on Zulip Sean (Aug 25 2020 at 21:16):

Sure, but that's not happening today or tomorrow, so until that's basically pending release, it's a non-solution :)

view this post on Zulip Sean (Aug 25 2020 at 21:16):

(hope, that is) ;)

view this post on Zulip starseeker (Aug 25 2020 at 21:16):

'specially since the planet seems to be moving to vulkan/metal...

view this post on Zulip Sean (Aug 25 2020 at 21:17):

skipping visuals with an alpha confirms there's a bug

view this post on Zulip Sean (Aug 25 2020 at 21:18):

definitely cool that it's fixed from users' perspective and we at least know more what the issue is

view this post on Zulip starseeker (Aug 25 2020 at 21:19):

We may also need to set some value to control the alphaMask on windows that have it - we're at the X11 layer with those calls, which I know virtually nothing about.

view this post on Zulip Sean (Aug 25 2020 at 21:20):

still could also be just that we never clear the alpha channel, that'd be my guess

view this post on Zulip Sean (Aug 25 2020 at 21:20):

in that case, something like glColorMask() to select the alpha channel, glClearColor() to set it to black or bg, then glClear(). I bet that does the trick

view this post on Zulip starseeker (Aug 25 2020 at 21:21):

Before each draw cycle you mean? Or when the window is created?

view this post on Zulip Sean (Aug 25 2020 at 21:21):

glColorMask(0, 0, 0, 1); glClearColor(0, 0, 0, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

view this post on Zulip Sean (Aug 25 2020 at 21:21):

just when the window is created

view this post on Zulip Sean (Aug 25 2020 at 21:24):

probably have to reset the mask to glColorMask(1, 1, 1, 1);

view this post on Zulip starseeker (Aug 25 2020 at 21:25):

That does seem to work, in a quick test.

view this post on Zulip Sean (Aug 25 2020 at 21:25):

kind of amazing if that's not somewhere in the code already

view this post on Zulip starseeker (Aug 25 2020 at 21:25):

Let me try the FB too - if that's good, as you say it's a better solution.

view this post on Zulip starseeker (Aug 25 2020 at 21:26):

Or you can commit it if you prefer, since it's your fix ;-)

view this post on Zulip Sean (Aug 25 2020 at 21:26):

no diff to me, I would have to search to even know where init is even happening.

view this post on Zulip Sean (Aug 25 2020 at 21:27):

used to do a lot more opengl back in the day. need to go through some vulkan exercises.

view this post on Zulip starseeker (Aug 25 2020 at 21:27):

/me isn't surprised - this code probably predates alpha channels, at least in any sort of practical implementation, so it was never added and never missed. I'll bet we have a bunch of stuff missing that we "should" be doing by modern standards...

view this post on Zulip Sean (Aug 25 2020 at 21:27):

I know the theory of the changes, but have no practical experience with it

view this post on Zulip Sean (Aug 25 2020 at 21:28):

nah, alpha channel have been a thing since the 80's, before it was even called OpenGL

view this post on Zulip Sean (Aug 25 2020 at 21:28):

PHIGS!

view this post on Zulip Sean (Aug 25 2020 at 21:29):

support has been a thing since before opengl 1.0

view this post on Zulip starseeker (Aug 25 2020 at 21:29):

Hmm. OK, probably just the active use of alpha channels for desktops then.

view this post on Zulip Sean (Aug 25 2020 at 21:30):

we're almost certainly just suffering from Xorg initializing glx differently from X11 or maybe nvidia defaulting to something different in the driver

view this post on Zulip starseeker (Aug 25 2020 at 21:31):

Maybe, but the symptoms at least are desktop specific - I wasn't restarting the Xserver (at least, not deliberately) flipping between Gnome and Fluxbox

view this post on Zulip Sean (Aug 25 2020 at 21:31):

like diff of having int alpha; in the code and someone coming along and going, oh, that should be on and changing it to int alpha=1.0; so we suddenly are in trouble because we assumed 0.0

view this post on Zulip Sean (Aug 25 2020 at 21:32):

you using Wayland?

view this post on Zulip starseeker (Aug 25 2020 at 21:32):

Should be Xorg - I've tried Wayland once or twice when Ubuntu came out with it, but wasn't quite there

view this post on Zulip starseeker (Aug 25 2020 at 21:35):

Blast it - now it's not working (???)

view this post on Zulip starseeker (Aug 25 2020 at 21:35):

What the heck.

view this post on Zulip starseeker (Aug 25 2020 at 21:36):

Wonder if I forgot to recompile or something - cleared out the window filters, and now I'm getting that transparency again with the dm and fb.

view this post on Zulip starseeker (Aug 25 2020 at 21:39):

@Sean Yeah, nothing doing now - can't clear the transparency.

view this post on Zulip Sean (Aug 25 2020 at 21:39):

I think I see it.

view this post on Zulip Sean (Aug 25 2020 at 21:40):

there's a bunch of glClearColor(0,0,0,0)'s in the code. that's asking the alpha to be transparent, so when it clears, it's set to zero but not visible..

view this post on Zulip Sean (Aug 25 2020 at 21:41):

try setting the four calls in ./glx/if_ogl.c to have alpha 1.0

view this post on Zulip Sean (Aug 25 2020 at 21:41):

er, 5 calls

view this post on Zulip Sean (Aug 25 2020 at 21:42):

yeah, I bet that's it... we're actually requesting a transparent background and it's finally obliging

view this post on Zulip starseeker (Aug 25 2020 at 21:43):

Do I still need to initialize as before? Changed all glClearColor settings to 1, still getting transparency

view this post on Zulip starseeker (Aug 25 2020 at 21:44):

Nope, that doesn't help

view this post on Zulip Sean (Aug 25 2020 at 21:45):

so you set glClearColor(#,#,#, 1.0)?

view this post on Zulip starseeker (Aug 25 2020 at 21:46):

yes

view this post on Zulip Sean (Aug 25 2020 at 21:46):

and that was on dm or fb?

view this post on Zulip starseeker (Aug 25 2020 at 21:46):

both

view this post on Zulip starseeker (Aug 25 2020 at 21:48):

patch

view this post on Zulip starseeker (Aug 25 2020 at 21:48):

Think that was what you meant?

view this post on Zulip Sean (Aug 25 2020 at 21:49):

/me looks

view this post on Zulip Sean (Aug 25 2020 at 21:53):

yeah, so that is what I had in mind, so while that's an issue, it's apparently not the issue

view this post on Zulip Sean (Aug 25 2020 at 21:54):

I wonder i ...

view this post on Zulip starseeker (Aug 25 2020 at 21:54):

So we should correct those anyway, just on general principles?

view this post on Zulip Sean (Aug 25 2020 at 21:54):

so is this mged -c or tk mged?

view this post on Zulip starseeker (Aug 25 2020 at 21:55):

mged -c

view this post on Zulip Sean (Aug 25 2020 at 21:55):

or both have the issu?

view this post on Zulip starseeker (Aug 25 2020 at 21:55):

Tk has never had it, as far as I know - embedding it in the Tk window seems to avoid the issue. (I always figured that was because of how Tk was creating their X11 windows...)

view this post on Zulip Sean (Aug 25 2020 at 21:56):

As much as I think it's wrong, I wouldn't change it if it's not fixing this issue as it could affect other things we're maybe not thinking about. At least, not without having a half dozen platforms manually demonstrating it's still working as expected.

view this post on Zulip Sean (Aug 25 2020 at 21:56):

ah, that's interesting

view this post on Zulip Sean (Aug 25 2020 at 21:57):

Tk definitely has a bit more going on

view this post on Zulip Sean (Aug 25 2020 at 21:58):

it's calling XChangeProperty, which might be setting the state differently.

view this post on Zulip Sean (Aug 25 2020 at 21:58):

So when it does the transarent thing, and you move the window

view this post on Zulip Sean (Aug 25 2020 at 21:58):

does it update the window contents, or does it look like the window took a snapshot of the background

view this post on Zulip Sean (Aug 25 2020 at 21:59):

of what's behind it

view this post on Zulip starseeker (Aug 25 2020 at 21:59):

It's like a pane of semitransparent glass

view this post on Zulip Sean (Aug 25 2020 at 21:59):

so it updates if you move it

view this post on Zulip starseeker (Aug 25 2020 at 21:59):

yes

view this post on Zulip Sean (Aug 25 2020 at 22:00):

try a hide/expose event (minimize + unminimize)

view this post on Zulip starseeker (Aug 25 2020 at 22:00):

no change - still shows/updating background

view this post on Zulip Sean (Aug 25 2020 at 22:01):

so yeah, then it's definitely been set up (and set up wrong)

view this post on Zulip Sean (Aug 25 2020 at 22:01):

do you know if it's a direct or indirect windowing context?

view this post on Zulip starseeker (Aug 25 2020 at 22:03):

Not sure

view this post on Zulip starseeker (Aug 25 2020 at 22:03):

Here's the visual, fwiw:
ogl_dm-2020-08-25-18-02.gif

view this post on Zulip Sean (Aug 25 2020 at 22:04):

OH, that's telling

view this post on Zulip Sean (Aug 25 2020 at 22:04):

notice it's blending the blue bg color

view this post on Zulip Sean (Aug 25 2020 at 22:05):

let's see if we can find where that blue is getting set

view this post on Zulip Sean (Aug 25 2020 at 22:06):

wait a min, didn't you say you were using dm-X? or is that dm-ogl?

view this post on Zulip starseeker (Aug 25 2020 at 22:07):

That's dm-ogl

view this post on Zulip starseeker (Aug 25 2020 at 22:07):

X doesn't have the issue

view this post on Zulip starseeker (Aug 25 2020 at 22:08):

That was why I've been futzing with fixing the classic X dm's update behavior - I figured I was going to need it if the ogl windows kept showing that transparency effect.

view this post on Zulip starseeker (Aug 25 2020 at 22:08):

(well that and it was busted, but that's what made it urgent)

view this post on Zulip Sean (Aug 25 2020 at 22:08):

okay, cool

view this post on Zulip starseeker (Aug 25 2020 at 22:08):

GLFW has some code that looks related to this alpha thing, but I've not wound through it yet

view this post on Zulip Sean (Aug 25 2020 at 22:09):

good news is .. the bug's in src/libdm/glx/dm-ogl.c ;)

view this post on Zulip starseeker (Aug 25 2020 at 22:09):

and if_ogl.c, but yes

view this post on Zulip Sean (Aug 25 2020 at 22:09):

what's an fb look like if you run rt on havoc?

view this post on Zulip Sean (Aug 25 2020 at 22:09):

(not embedded, transient window)

view this post on Zulip starseeker (Aug 25 2020 at 22:11):

havoc-2020-08-25-18-10.gif

view this post on Zulip starseeker (Aug 25 2020 at 22:14):

Maybe related, although they're doing this if the window is not transparent... https://github.com/glfw/glfw/blob/master/src/x11_window.c#L338

view this post on Zulip starseeker (Aug 25 2020 at 22:17):

/me is reminded he needs to experiment with a GLFW based libdm/fb backend... won't work for embedded Tk windows, but for stand-alone gsh it would be perfect...

view this post on Zulip Sean (Aug 25 2020 at 22:19):

hm, everyone is calling up that property and I have no idea what this XAtom stuff is all about

view this post on Zulip Sean (Aug 25 2020 at 22:19):

no idea what XA_CARDINAL means, can't find much on it, except that it's 6

view this post on Zulip starseeker (Aug 25 2020 at 22:20):

bbiab

view this post on Zulip Sean (Aug 25 2020 at 22:21):

oh, this might be it

view this post on Zulip Sean (Aug 25 2020 at 22:37):

give that a try

view this post on Zulip starseeker (Aug 25 2020 at 23:30):

Nope - still transparent.

view this post on Zulip Sean (Aug 25 2020 at 23:55):

hm, another thought could be a mismatch between glx and tk

view this post on Zulip Sean (Aug 25 2020 at 23:55):

does the tk dm work?

view this post on Zulip starseeker (Aug 26 2020 at 00:13):

No, unfortunately.

view this post on Zulip starseeker (Aug 26 2020 at 00:13):

I had started on a rewrite earlier, but didn't get it to completion before I had to shift to other stuff

view this post on Zulip Sean (Aug 26 2020 at 00:13):

wouldn't matter looking at the code, but I see it doesn't call glx

view this post on Zulip Sean (Aug 26 2020 at 18:21):

@starseeker diminishing returns. I really think the issue is how the window+context is being set up, prior to opengl (which is why they made no change), but I think we can just run with your fix for now. If I had a platform to debug on in front of me, I think I could knock it out in an evening, but again ... diminishing returns. I think a better fix would be dm-tk or dm-osg or dm-sdl or dm-glut where this would almost certainly become a non-issue.

view this post on Zulip starseeker (Aug 26 2020 at 18:22):

Agreed. Can revisit if we hit a case in the wild where there are no alpha free X11 windows.

view this post on Zulip Sean (Aug 26 2020 at 18:22):

Looking at the code, we're mixing old and new calls for creating a context. For example, we don't call glXChooseVisual with attributes, we do it all manually (old school).

view this post on Zulip starseeker (Aug 26 2020 at 18:23):

/me is pecking at the tk dm a bit again, but no chance it'll be ready to replace X by release time.

view this post on Zulip Sean (Aug 26 2020 at 18:23):

that's where I suspect the issue is. don't even think it's "bug" per-se, as much as it is just something we're not specifying, that we didn't need to before but could/should now because of change.

view this post on Zulip Sean (Aug 26 2020 at 18:24):

thought it was opengl, but your video yesterday that showed it clearly blending the window with a background color being draw punts this out of opengl's domain and into the window's.

view this post on Zulip starseeker (Aug 26 2020 at 18:27):

Oh, while I'm thinking about it: @Daniel Rossberg , do you need the changes you started with librt in the 7.32.0 release? If not my inclination is to not merge those to RELEASE yet, since that's a pretty low level of the stack to be modifying right before a release.

view this post on Zulip Sean (Aug 26 2020 at 18:29):

sad thing is I bet a dm-sdl or dm-glut could be implemented in less than a day. can almost see all the lines of code needed.

view this post on Zulip Sean (Aug 26 2020 at 18:30):

need to get that comfortable with qt :/

view this post on Zulip Daniel Rossberg (Aug 26 2020 at 19:36):

It's okay for me to have them in the release after the 7.32.0.


Last updated: Oct 09 2024 at 00:44 UTC