PDA

View Full Version : Change context in QGLWidget



aftos
2nd June 2015, 12:57
Hi all,

In my (desktop) application i need to enable alpha channel in my QGLWidget under certain circumstances. How do i do this?

I've tried various solutions, like getting current format from current context, enable alpha and set new context with the new format but no luck.

I've tried directly (even though obsolete) to do: const_cast<MyGLWidget *>(context())->setFormat(enabledAlphaFormat), where enabledAlphaFormat is the new format created from format() (tried also requestedFormat().

How can i do this?

Thank you in advance

ps. i've tried to set alpha enabled in the constructor of MyGLWidget (by passing custom QGLFormat in QGLWidget) and it works but i don't want alpha to be enabled all the time.