From: No Idea <kiithsacmp@gm...> - 2012-03-31 21:12:18
I've been looking around and experimenting with the Stellarium code base a bit.
I've succeeded in separating some of the GL initialization code, results can
be seen on this branch:
(I'm aware that all code is in headers - most of it will be thrown away before
it's separated into .cpp files)
The changes are in the following revisions:
Originally I tried to separate GL from the rest of Stellarium as well
as Qt code,
but I noticed that it's very tightly bound with Qt. Basically the only ways to
separate Qt and GL code would be to a) use a hacky implementation completely
avoiding QGL or b) wrapping most QGL classes.
So I've concluded it's not a good idea.
(As a side note, some of the QGL functionality is quite useful -
although I'm wary of them keeping up with new GL versions and
not removing support for old ones (as GL1 in Qt5))
What I'm proposing now is a few API-independent base interfaces
(Renderer, VertexBuffer, etc - whatever turns out to be needed) with
implementations, based on Qt-with-GL.
E.g. QGLRenderer (shared code) extended by QGL1Renderer, QGL2Renderer, etc.
The interfaces themselves would be completely independent of GL, and,
if possible, Qt.
I.e. there would still be space for a SWRenderer or
An important benefit compared to the current implementation would be ability
to choose a backend at runtime (maybe even fallback? E.g. GL2 fails - try GL1
- fails - try SW)
Also, no global state (except on the side of Qt/GL themselves),
and especially no direct usage of GL anywhere, which should make it both easier
to debug and to optimize.
The vertex data would be managed by the backend (passed to it by the user
code that can generate/load it). User code would only use flyweight objects
to reference the data. Added bonus to that would be that the backend
could control draw order of transparent objects
(I'm not proposing to do that - not sure if I can in time - but it'd
Various small vertex data like single points and lines could be
batched and drawn
together. (Again, not proposing to do that - but can be implemented in
Get latest updates about Open Source Projects, Conferences and News.