[Kstars-devel] KStars & OpenGL
Luiz Romário Santana Rios
luizromario at gmail.com
Fri May 28 17:04:15 CEST 2010
2010/5/28 Henry de Valence <hdevalence at gmail.com>
> I've been trying to work out a way for KStars to be able to do both GL and
> non-GL painting. The problem is that in order to paint using GL, one must
> use
> a QGLWidget, but in order to paint using a normal QPainter (i.e., without
> GL),
> one needs to use a QWidget.
I think it's possible to use QGLWidget for rendering with a QPainter like
any other normal widget, since it inherits from QWidget. Take a look at
here: http://doc.trolltech.com/4.6/qglwidget.html#details
>You inherit from it and use the subclass like any other QWidget, except
that you have the choice between using QPainter and standard OpenGL
rendering commands.
> Currently the SkyMap class inherits QWidget and
> uses that to paint. We can't make classes that inherit from SkyMap and one
> of
> (QWidget, QGLWidget), because SkyMap would still have to inherit QObject to
> get signals and slots, and multiple inheritance of QObject is not allowed.
> I've been working at separating all of the SkyMap code that is dependent on
> the inheritance from QWidget into another class for the past week, and even
> though the diff is so far over 2000 lines, I'm not even close to getting it
> to
> work, and it doesn't seem likely that I will be able to get it to work, at
> least within the time that I have -- since I have to actually implement GL
> painting, not just refactor things.
>
> When I was talking to Akarsh about this, he suggested the following:
> 1. We use OpenGL as the only rendering engine.
> 2. When dealing with "non-3D" graphics cards which don't have hardware
> support
> for fancy stuff, we cut down on effects and use OpenGL just as we'd use
> QPainter.
>
> One way to implement #2 would be to have KStars monitor its frame rate, and
> then automatically adjust the graphics quality so that it fell within a
> certain range (say, minimum 10 FPS, maximum 30 FPS): if the frame rate is
> too
> low, it would disable certain effects, and if the frame rate is too high,
> it
> would enable more expensive effects. Since I plan on putting drawing
> methods
> into a helper class (so that the drawing code is all in one place), it
> should
> be possible to have that helper class manage the level of graphical
> effects,
> taking into account performance and graphics card features.
>
> Does this seem like a reasonable approach?
>
> Henry de Valence
> _______________________________________________
> Kstars-devel mailing list
> Kstars-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kstars-devel
>
--
Luiz Romário Santana Rios
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kstars-devel/attachments/20100528/5354b352/attachment.htm
More information about the Kstars-devel
mailing list