-
from wxPython.wx import *
try:
from wxPython.glcanvas import *
+
class MyCanvasBase(wxGLCanvas):
def __init__(self, parent):
wxGLCanvas.__init__(self, parent, -1)
glVertex3f(-0.5, 0.5,-0.5)
glEnd()
- glRotatef(self.lasty - self.y, 1.0, 0.0, 0.0);
- glRotatef(self.lastx - self.x, 0.0, 1.0, 0.0);
+ glRotatef((self.lasty - self.y)/100., 1.0, 0.0, 0.0);
+ glRotatef((self.lastx - self.x)/100., 0.0, 1.0, 0.0);
self.SwapBuffers()
glDepthFunc(GL_LESS)
glEnable(GL_DEPTH_TEST)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
+ # position viewer
+ glMatrixMode(GL_MODELVIEW);
def OnDraw(self):
# clear color and depth buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- # position viewer
- glMatrixMode(GL_MODELVIEW);
# use a fresh transformation matrix
glPushMatrix()
# position object
glTranslate(0, -1, 0)
glRotate(250, 1, 0, 0)
- glutSolidCone(1, 2, 50, 10)
+ glutSolidCone(0.5, 1, 30, 5)
glPopMatrix()
+ glRotatef((self.lasty - self.y)/100., 0.0, 0.0, 1.0);
+ glRotatef(0.0, (self.lastx - self.x)/100., 1.0, 0.0);
# push into visible buffer
self.SwapBuffers()
if __name__ == '__main__':
_test()
+