[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Newbe question on QGLWidget
From:       "duncan duncan" <duncan73 () gmail ! com>
Date:       2007-11-27 23:47:34
Message-ID: 6e6d3a000711271547x3027f068qeebcc256fe96452c () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

[Attachment #5 (text/html)]

Hello.<br><br>I am playing with the QGLWidget and I have some problems. <br><br>I am \
able to draw an object and rotate/zoom/move it. <br>My problem now is that I&#39;d \
like to draw the object in 4 viewport (no problem here) but with different point of \
view. <br>Basically I am trying to draw the 3 basic orthogonal view (XY, XZ, YZ) and \
a perspective view. <br>I am not interested in a 2D view for the orthogonal \
projections, since I will need the full 3D object anyway.<br><br>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.  <br>Looking around it seems that the correct solution is to \
move the camera to have the correct point of view. <br>So what are the correct way ? \
Rotate the object or move the camera ?<br><br>And if the correct way is to move the \
camera, where I can find a simple example ?  <br><br>My idea is to make something \
like this:<br><br><pre>glMatrixMode(GL_PROJECTION)<br>glLoadIdentity()<br>glViewport(0, \
0, w, h)<br>gluLookAt(eyeX, eyeY, eyeZ, <br>          centerX, centerY, centerZ,<br>  \
upX, upY, upZ); <br>glMatrixMode(GL_MODELVIEW)<br><br>and then render my \
object<br><br>but I cannot understand if this is correct and where I must do it.<br>I \
suspect that I must do it in the paintGL function, setting the values of<br>the \
parameters for gluLookAt in some other places (I am thinking about the properties \
<br>of the viewport)<br><br>Is this the correct approach ? If not, where is my error \
?<br><br>thanks in advance<br>Gianluca </pre>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic