Page 1 of 1

Experiments with OpenGL 2.0 on OS X

Posted: 04.01.2006, 09:11
by dirkpitt
Anyone who has recently tried Celestia on OS X 10.4.3 (and possibly only on recent video cards) will have noticed that the OpenGL 2.0 render path is now selectable, but gives horribly incorrect rendering.

Since the PC and Linux versions render splendidly (for the most part), this is obviously a bug in Apple's GLSL driver code. So I spent the afternoon copying and pasting Celestia's generated GLSL shader code from /tmp/celestia-shaders.log into Apple's OpenGL Shader Builder. With some experimentation, I think I may have pinned down the issue. Here're test renderings of Saturn's ring shadow with a modified version of Celestia's GLSL code:

Image Image

Smooth-edged ring shadows are a hallmark of the OGL2 render path. Compare it to the Vertex Program path:

Image

I am pretty sure that Apple's GLSL driver code does not interpret structs, or at least uniform structs correctly. As Celestia declares lights using uniform structs (this is 100% ok by the way), this was why previously the GL 2.0 path did not render lighting properly.

The screenshots substitute gl_LightSource[i] for all uses of the light struct. This is incorrect so the lighting direction is off, etc, but it does demonstrate that the light struct was not being recognized properly before. This is enough info I think to file a detailed bug report with Apple.

Posted: 04.01.2006, 09:35
by Cham
I always knew that Apple is a shi%&*# software company when it comes to video card drivers. :evil: :evil: . I hate'em ! They need to be kicked in the ba*&%$ :evil: :evil:. I had so much troubles with their crappy %#@$ video cards and OS X before :evil: :evil: SHAME ON YOU APPLE ! :evil: :evil:. This is frustrating me beyond any reasonable description. :evil: :evil:

Posted: 04.01.2006, 10:08
by dirkpitt
At least now there is hope. As Apple migrates most or all of its stuff to the new OpenGL 2.0 architecture we can at least hope that old problems we've been having with video drivers on OS X will become a thing of the past.

Posted: 04.01.2006, 21:53
by julesstoop
Wow :)
This is certainly good news. There actually is a solution thinkable.
The guys at Apple should thank you for hunting down their bugs.

Posted: 05.01.2006, 17:29
by dirkpitt
Chris has implemented a workaround for the aforementioned issue and here are some screenshots:

Image

This shows off the basic stuff (notice that Saturn now renders correctly), as well as multiple illumination on a fictional planet in a quadruple star system (this, minus a star). The star system looks like this. Multiple illumination and smooth ring shadows only appear in the OpenGL 2.0 render path.

However not all is rosy, as it turns out eclipse shadows have issues:

Image

This is a solar eclipse (I got the cel url from here) with an eclipse shadow on the Pacific Ocean. It's mostly all right, but if you look closely there are some stripe artifacts caused by an interaction between eclipse shadows and night textures. I'm still investigating whether this is another driver bug or not. Still, this is very exciting stuff and I'm literally losing sleep debugging and testing this!

Posted: 05.01.2006, 17:36
by Cham
Dirkpitt,

thanks a LOT for your efforts. It's appreciated. Keep up the good work ! :)

And fill up the bug reports to that crappy %#$@*& Apple company ! >8*(

Posted: 07.01.2006, 13:32
by dirkpitt
Ok, I just filed a bug report with Apple (#4402259). I don't know when it will be fixed, but at least Celestia 1.4.1 should have the workaround mentioned above, and hence, a working OpenGL 2.0 render path on OS X.

Posted: 17.02.2006, 06:46
by dirkpitt
FYI, a fix for the eclipse shadow issue (not an Apple bug) will be in Celestia 1.4.1. This means Celestia on OS X ought to have
OpenGL 2.0 render path functionality equal to Windows and Linux platforms on supported hardware running 10.4.3+.