[Qt-interest] OpenGL and SVG in Qt

Samuel Rødal samuel.rodal at nokia.com
Wed Nov 3 10:08:53 CET 2010


On 10/30/2010 09:31 AM, ext Nathan Hüsken wrote:
> Hey,
>
> I have a few questions about Qts OpenGL and SVG support:
>
> - I want to load textures, used in different OpenGL windows and/or
> QGLWidget. This can be done when creating the context with (under Linux)
> glXCreateContext by providing the share parameter with another context.
> So can I somehow get the context from a QGLWidget? Can I somehow make
> the QGLWidget specify the share parameter when creating its context?

QGLWidget's constructor takes a shareContext, so if you have several 
QGLWidgets they can all share GL objects that way.

> - I want to load a SVG using QtSvg and display in an OpenGL window. If I
> understand correctly, this is done over the QPainter interface. Can
> QPainter somehow be made to draw (by directing its OpenGL commands) to
> my own OpenGL window instead of a QGLWidget?

QPainter operates on a QPaintDevice, of which QGLWidget is a subclass. 
You might be able to trick it to draw somewhere else by making a 
different context active while it's painting, but it's not officially 
supported. Qt's OpenGL module assumes it is in control of context 
handling, if you use the lower layers directly Qt might be confused 
(QGLContext::currentContext() would no longer return the correct value 
any more for example).

--
Samuel



More information about the Qt-interest-old mailing list