[PyQt] Newbe question on QGLWidget

duncan duncan duncan73 at gmail.com
Tue Nov 27 23:47:34 GMT 2007


Hello.

I am playing with the QGLWidget and I have some problems.

I am able to draw an object and rotate/zoom/move it.
My problem now is that I'd like to draw the object in 4 viewport (no problem
here) but with different point of view.
Basically I am trying to draw the 3 basic orthogonal view (XY, XZ, YZ) and a
perspective view.
I am not interested in a 2D view for the orthogonal projections, since I
will need the full 3D object anyway.

Now I get this simply rotating the object around the axis as I need, but I
am not sure this is the correct thing to do.
Looking around it seems that the correct solution is to move the camera to
have the correct point of view.
So what are the correct way ? Rotate the object or move the camera ?

And if the correct way is to move the camera, where I can find a simple
example ?

My idea is to make something like this:

glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glViewport(0, 0, w, h)
gluLookAt(eyeX, eyeY, eyeZ,
          centerX, centerY, centerZ,
          upX, upY, upZ);
glMatrixMode(GL_MODELVIEW)

and then render my object

but I cannot understand if this is correct and where I must do it.
I suspect that I must do it in the paintGL function, setting the values of
the parameters for gluLookAt in some other places (I am thinking about
the properties
of the viewport)

Is this the correct approach ? If not, where is my error ?

thanks in advance
Gianluca
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20071127/b7c9aa2c/attachment.html


More information about the PyQt mailing list