[Kde-games-devel] Re: simple QGLWidget program

Neil Stevens neil at hakubi.us
Mon Jan 26 20:20:36 CET 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday January 26, 2004 10:49 am, Kevin Krammer wrote:
> On Monday 26 January 2004 19:39, Jan Bernatik wrote:
> > > Try setting an initial size before showing the widget.
> > > Something like
> > > w.resize(600, 400);
> >
> > Yes, I tried this. Window was resized properly ( means GL widget was
> > resizing), so that makes me think that widget is "initialized"
> > properly. I'm not sure how to set QGLWidget to use doublebuffering or
> > not & stuff. I will check.
>
> Rename your methods Draw to paintGL or call makeCurrent before drawing.
>
> At least that's how I understand the docs :)

- From the QGLWidget docs:

***
QGLWidget provides three convenient virtual functions that you can 
reimplement in your subclass to perform the typical OpenGL tasks: 

paintGL() - Renders the OpenGL scene. Gets called whenever the widget needs 
to be updated.

resizeGL() - Sets up the OpenGL viewport, projection, etc. Gets called 
whenever the the widget has been resized (and also when it is shown for 
the first time because all newly created widgets get a resize event 
automatically). 

initializeGL() - Sets up the OpenGL rendering context, defines display 
lists, etc. Gets called once before the first time resizeGL() or paintGL() 
is called. 
***

So indeed, one must reimplement those virtuals.

- -- 
Neil Stevens - neil at hakubi.us

"It's snowing, it's snowing! God, I hate this weather."
    They Might Be Giants, __New York City__
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQFAFWiEf7mnligQOmERAovzAJ4qnmncQSrKkX+PWECyUEppkPd4bACdGiF1
AnvPDcc6kYWHK5ysp6FSfko=
=rpl6
-----END PGP SIGNATURE-----



More information about the kde-games-devel mailing list