[Kstars-devel] Re: Planet textures with OpenGL

Alexey Khudyakov alexey.skladnoy at gmail.com
Fri Apr 8 20:14:09 CEST 2011


On 07.04.2011 10:37, Akarsh Simha wrote:
> So when the paint device changes, the context is reset. So the point
> of passing a QGLContext to the QGLWidget is more so that you can pass
> QGLContext subclasses, like the documentation says.
>
> Please correct me if I'm wrong here. My understanding is still fuzzy.
>
So is mine. I have following hyothesis. Aquired texture IDs becomes 
invalid when context is reset and planets aquire them before it's 
transferred to QGLWidget.

IMHO the best way to deal with the problem is to aquire texture ID when 
they are used for first time. So they will be generated after transfer 
of ownership.

Maybe TextureManager should not own context at all and have it passed in 
as parameter. This way we can avoid transfering of context at all.
If one wants to use QImage he don't need context. If he wants to use 
openGL he already have context. Another option is to use
QGLContext::currentContext ()


More information about the Kstars-devel mailing list