KStars with experimental OpenGL support in RC2
Well, this was a little hurried and late, but I introduced some largish changes into what’s going to become RC2 just a few minutes back. No new strings, to the best of my knowledge. Let me explain what they are.
Harry de Valence worked with KStars this summer and his (GSoC) project involved writing code that would render the sky map with OpenGL, while still keeping the native QPainter drawing, to ensure that KStars doesn’t crawl on older hardware without hardware acceleration. Well, Harry’s task was rather tough, because he had to deal with badly structured code, but he was able to give us a working OpenGL sky map with a few regressions at the end of his project. The most important unsolved problem, however, was that there was no way to switch between the two paint engines at run time.
We decided not to leave the code in Harry’s branch, and merged it into trunk, so that the code would be more accessible, and we might arrive at a solution at least before release. When 4.6 was branched out from trunk, we had a version of KStars that would throw up a black screen with some text at the corners upon launching! This was one of the regressions with OpenGL — you couldn’t use infoboxes (those boxes that tell you what KStars is looking at, what the time of the simulation is etc.) with GL, so you had to manually disable them to see the sky map. And to add to that, we had a couple of other problems with GL. And you couldn’t switch out of GL without rebuilding KStars.
Of course, one of the solutions was to just disable GL and fallback to QPainter, without adding any new functionality, but lots of new code. I didn’t want to subscribe to this — it gives me this feeling that I’m doing what some proprietary software companies do to enforce DRM.
Our solution to this problem involved breaking up a class that’s very central to KStars — the SkyMap class, which took care of the sky map in totality — painting, projection, events. Not good. Harry had already broken away projection, and in the process of cleaning the code, solved several really strange bugs in KStars. What was left was to break up painting and event handling, so that we could change our canvas at run time.
This time of the year being the winter break at UT Austin, I thought I should finish this. My implementation of this (warning: physics student trying to write code) is now merged into the 4.6 branch. I should’ve probably done it before, but yeah, it stretched to fit the time before RC2.
The only regression I observe with this change over the usual native painting functionality, is that infoboxes flicker when you drag them around. I’m sure that’s a very small thing to trade for the awesome speed and smoothness that GL gives you, when you need it.
So you can now switch backends at runtime:
Testing
We most certainly need a whole lot of testing. Please help the KStars team by seeing if it builds, renders fine, switches backends with no issues, and file any bugs you may have on bugs.kde.org. We will try to fix them before the final tag.
Thanks for reading.
Time for me to get back to physics now!


Martin Gräßlin 7:17 pm on January 2, 2011 Permalink | Log in to Reply
I just built kstars from trunk and gave it a try with fglrx driver. I am sorry to say that it does not work at all
I only see a white screen and when I start to move the scene I get lot’s of flickering with visible stars in between.
Btw: which OpenGL version are you targeting?
Martin Gräßlin 8:01 pm on January 2, 2011 Permalink | Log in to Reply
Just tried on my other system with nouveau driver (which renders KWin GLES correctly) and I see some rendering artefacts in the milky way.
See: http://wstaw.org/m/2011/01/02/plasma-desktoprL2578.jpg
It does not mean that there is a problem in the rendering, it could as well be a bug in nouveau. Nevertheless it might be worth to look at it
Med 8:54 pm on January 2, 2011 Permalink
If i remember it was reported that it worked fined with mesa’s software rendering. I have no way of testing that easily before the final version is out. Wouldn’t it indicate that the problem is in nouveau? As for the fglrx driver, do you have any clue where the problem might be?
Martin Gräßlin 9:13 pm on January 2, 2011 Permalink
The mesa software rasterizer has nothing to do with the Gallium3D state tracker used in nouveau
Maybe? Maybe not? Difficult to say. As I have problems with other drivers as well I would not bet on driver bugs.
No sorry, I do not know the KStars code at all. So I cannot comment on it.
Akarsh Simha 2:56 am on January 3, 2011 Permalink
Hi
I want to ask if the QPainter backend works properly on these systems. If that is not the case, this would be release critical, and we may need to revert the entire OGL stuff.
Can you see the Sky map in QPainter mode with no regressions?
Regards
Akarsh
Manuel Mommertz 8:24 pm on January 2, 2011 Permalink | Log in to Reply
With intel graphics, it works very well. I couldn’t see any rendering glitsches. Works quite fast. Though I had to deactivate the rendering of the milky way while moving as this was very slow.
Akarsh Simha 2:58 am on January 3, 2011 Permalink | Log in to Reply
Oh. I haven’t had Milky Way trouble. But when running at 2 minutes / frame speed, I got 16 fps with OpenGL and ~ 6 fps with native painting.
Manuel Mommertz 3:12 am on January 3, 2011 Permalink
milky way is deactivated on move per default. so if you don’t explicitly activated them, you don’t see it
how do you get the fps numbers?
Akarsh Simha 3:22 am on January 3, 2011 Permalink
Oh, didn’t realize that. I hardly twiddle with the hidden objects settings
If you built with debugging, then you’ll see the FPS numbers being written to the console. Maybe we should do something more elegant.