Experiments with OpenGL 2.0 on OS X

The place to discuss creating, porting and modifying Celestia's source code.
Avatar
Topic author
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Experiments with OpenGL 2.0 on OS X

Post #1by dirkpitt » 04.01.2006, 09:11

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.

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #2by Cham » 04.01.2006, 09:35

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:
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
Topic author
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #3by dirkpitt » 04.01.2006, 10:08

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.

julesstoop
Posts: 408
Joined: 27.03.2002
With us: 22 years 8 months
Location: Leiden, The Netherlands

Post #4by julesstoop » 04.01.2006, 21:53

Wow :)
This is certainly good news. There actually is a solution thinkable.
The guys at Apple should thank you for hunting down their bugs.
Lapinism matters!
http://settuno.com/

Avatar
Topic author
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #5by dirkpitt » 05.01.2006, 17:29

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!

Avatar
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Post #6by Cham » 05.01.2006, 17:36

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*(
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
Topic author
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #7by dirkpitt » 07.01.2006, 13:32

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.

Avatar
Topic author
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years 1 month

Post #8by dirkpitt » 17.02.2006, 06:46

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+.


Return to “Development”