try:
# The Python OpenGL package can be found at
# http://PyOpenGL.sourceforge.net/
from OpenGL.GL import *
from OpenGL.GLUT import *
try:
# The Python OpenGL package can be found at
# http://PyOpenGL.sourceforge.net/
from OpenGL.GL import *
from OpenGL.GLUT import *
box.Add(btn, 0, wxALIGN_CENTER|wxALL, 15)
EVT_BUTTON(self, k, self.OnButton)
box.Add(btn, 0, wxALIGN_CENTER|wxALL, 15)
EVT_BUTTON(self, k, self.OnButton)
- self.SetAutoLayout(true)
+ #** Enable this to show putting a wxGLCanvas on the wxPanel
+ if 0:
+ c = CubeCanvas(self)
+ c.SetSize((200, 200))
+ box.Add(c, 0, wxALIGN_CENTER|wxALL, 15)
+
+ self.SetAutoLayout(True)
def OnButton(self, evt):
canvasClassName = buttonDefs[evt.GetId()][0]
canvasClass = eval(canvasClassName)
frame = wxFrame(None, -1, canvasClassName, size=(400,400))
canvas = canvasClass(frame)
def OnButton(self, evt):
canvasClassName = buttonDefs[evt.GetId()][0]
canvasClass = eval(canvasClassName)
frame = wxFrame(None, -1, canvasClassName, size=(400,400))
canvas = canvasClass(frame)
class MyCanvasBase(wxGLCanvas):
def __init__(self, parent):
wxGLCanvas.__init__(self, parent, -1)
class MyCanvasBase(wxGLCanvas):
def __init__(self, parent):
wxGLCanvas.__init__(self, parent, -1)
# initial mouse position
self.lastx = self.x = 30
self.lasty = self.y = 30
EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
EVT_SIZE(self, self.OnSize)
EVT_PAINT(self, self.OnPaint)
# initial mouse position
self.lastx = self.x = 30
self.lasty = self.y = 30
EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
EVT_SIZE(self, self.OnSize)
EVT_PAINT(self, self.OnPaint)
- #EVT_LEFT_DOWN(self, self.OnMouseDown) # needs fixing...
- #EVT_LEFT_UP(self, self.OnMouseUp)
- #EVT_MOTION(self, self.OnMouseMotion)
+ EVT_LEFT_DOWN(self, self.OnMouseDown) # needs fixing...
+ EVT_LEFT_UP(self, self.OnMouseUp)
+ EVT_MOTION(self, self.OnMouseMotion)
def OnEraseBackground(self, event):
pass # Do nothing, to avoid flashing on MSW.
def OnEraseBackground(self, event):
pass # Do nothing, to avoid flashing on MSW.
if evt.Dragging() and evt.LeftIsDown():
self.x, self.y = self.lastx, self.lasty
self.x, self.y = evt.GetPosition()
if evt.Dragging() and evt.LeftIsDown():
self.x, self.y = self.lastx, self.lasty
self.x, self.y = evt.GetPosition()
- 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);
- glutSolidCone(1, 2, 50, 10)
+ glutSolidCone(0.5, 1, 30, 5)
+ glRotatef((self.lasty - self.y)/100., 0.0, 0.0, 1.0);
+ glRotatef(0.0, (self.lastx - self.x)/100., 1.0, 0.0);
frame = wxFrame(None, -1, "GL Demos", wxDefaultPosition, wxSize(600,300))
#win = ConeCanvas(frame)
MySplitter(frame)
frame = wxFrame(None, -1, "GL Demos", wxDefaultPosition, wxSize(600,300))
#win = ConeCanvas(frame)
MySplitter(frame)