Patch #568403
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15819 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
from wxPython.wx import *
|
from wxPython.wx import *
|
||||||
try:
|
try:
|
||||||
from wxPython.glcanvas import *
|
from wxPython.glcanvas import *
|
||||||
@@ -75,6 +74,7 @@ else:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MyCanvasBase(wxGLCanvas):
|
class MyCanvasBase(wxGLCanvas):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wxGLCanvas.__init__(self, parent, -1)
|
wxGLCanvas.__init__(self, parent, -1)
|
||||||
@@ -183,8 +183,8 @@ else:
|
|||||||
glVertex3f(-0.5, 0.5,-0.5)
|
glVertex3f(-0.5, 0.5,-0.5)
|
||||||
glEnd()
|
glEnd()
|
||||||
|
|
||||||
glRotatef(self.lasty - self.y, 1.0, 0.0, 0.0);
|
glRotatef((self.lasty - self.y)/100., 1.0, 0.0, 0.0);
|
||||||
glRotatef(self.lastx - self.x, 0.0, 1.0, 0.0);
|
glRotatef((self.lastx - self.x)/100., 0.0, 1.0, 0.0);
|
||||||
|
|
||||||
self.SwapBuffers()
|
self.SwapBuffers()
|
||||||
|
|
||||||
@@ -211,13 +211,13 @@ else:
|
|||||||
glDepthFunc(GL_LESS)
|
glDepthFunc(GL_LESS)
|
||||||
glEnable(GL_DEPTH_TEST)
|
glEnable(GL_DEPTH_TEST)
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
||||||
|
# position viewer
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
|
|
||||||
def OnDraw(self):
|
def OnDraw(self):
|
||||||
# clear color and depth buffers
|
# clear color and depth buffers
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
# position viewer
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
# use a fresh transformation matrix
|
# use a fresh transformation matrix
|
||||||
glPushMatrix()
|
glPushMatrix()
|
||||||
# position object
|
# position object
|
||||||
@@ -227,8 +227,10 @@ else:
|
|||||||
|
|
||||||
glTranslate(0, -1, 0)
|
glTranslate(0, -1, 0)
|
||||||
glRotate(250, 1, 0, 0)
|
glRotate(250, 1, 0, 0)
|
||||||
glutSolidCone(1, 2, 50, 10)
|
glutSolidCone(0.5, 1, 30, 5)
|
||||||
glPopMatrix()
|
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
|
# push into visible buffer
|
||||||
self.SwapBuffers()
|
self.SwapBuffers()
|
||||||
|
|
||||||
@@ -268,3 +270,4 @@ def _test():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
_test()
|
_test()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user