[Qt-interest] opengl qgraphicsitem?

Oliver Demetz forenbeitraege at oliverdemetz.de
Thu Oct 22 23:30:40 CEST 2009


You can even use OpenGL more extensively than described in the dojo.

If the viewport of your QGraphicsView is a QGLWidget, then it is even 
allowed to make gl-calls in the paint event of all QGraphicsItems!!!!

And the nice thing is that also the coordinate systems (model view 
matrix and so on) are perfectly adjusted by the subsystem for you. This 
means as a simple example you can substitute a simple paint event like

void paint ( QPainter * painter, const QStyleOptionGraphicsItem * 
option, QWidget * widget )
{
	painter->drawLine(p1,p2);
}

by

void paint ( QPainter * painter, const QStyleOptionGraphicsItem * 
option, QWidget * widget )
{
	glBegin(GL_LINES);
	glVertex2f(p1.x(), p1.y());
	glVertex2f(p2.x(), p2.y());
	glEnd();
}

I am actually using this extensively and I can use maximally efficient 
and optimised  OpenGL code side-by-side with nicely readable and well 
understandable Qt-c++ code.

Regards,
Oliver


Thiago Macieira schrieb:
> Em Quinta-feira 22 Outubro 2009, às 21:26:25, você escreveu:
>>> http://labs.trolltech.com/blogs/2008/06/27/accelerate-your-widgets-
>>> with-opengl/
>> Any ideas on where to download the example?  The website says to do an
>> svn checkout at:
>>   svn://labs.trolltech.com/svn/graphics/dojo/modelviewer
>> But when I do that I get the error,
>>   svn: Can't connect to host 'labs.trolltech.com': Connection timed out
> 
> The dojo has moved.
> 
> See http://qt.gitorious.org/qt-labs/graphics-dojo for more information on how 
> to obtain the sources.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list