[PyOpenGL-Users] Example of using OpenGL.trackball?
Brought to you by:
mcfletch
From: Rick M. <rm...@sa...> - 2004-01-31 06:53:17
|
Does anyone have an example of using OpenGL.trackball? I'm having a hard time getting it to work. I initialize the trackball: self.tb = Trackball() On mouse movement (I'm doing this under GtkGLExt, so it's called ButtonMovement, but the idea is the same) I do: def button_motion(self, width, height, event): if event.state == gtk.gdk.BUTTON1_MASK: self.tb.update(self.beginx,self.beginy,event.x,event.y, width,height) Finally, in display I do this: def display(self, *args): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glPushMatrix() glTranslatef(self.transx,self.transy,self.depth) rotmtx = self.tb.matrix glMultMatrixf(rotmtx) glCallList(1) glPopMatrix() return Am I doing something bone-headed here? In the past I've just done the rotations by hand, but I wanted to implement a real trackball. R. Rick Muller rm...@sa... |