OpenGLContext Updated to wxPython 2.8 (finally)
Written by
on
in
Snaking.
Finally got around to fixing my wxPython install on my workstation. Turns out you need to do an "eselect wxwidgets" operation to get the wxPython links to set up properly. With that done, updated the OpenGLContext wxPython context so that it works with wxPython 2.8.
That lets the "browser.visual" module work again. This is a cheap little hack that tries to create a vPython-like environment for writing "my first 3D world" scripts. Under the covers the world is actually a VRML97 environment (though it uses simplified custom nodes) and you can load any VRML97 code OpenGLContext can handle into your context.
I never really got to the point of finishing the environment, so its nowhere near as elegant as vPython, but it does make for some fairly simple code...
from OpenGLContext.browser.visual import *
import time
scene.visible = 1
sphere( color = (1,0,0), pos=(0,0,0) )
cone( color = (0,0,1), pos=(2,0,0), length=2 )
cylinder( color = (0,1,0), pos=(-2,0,0), length=4)
box( color = (.5,.5,.5), pos=(0,-.5,0), size=(6,1,4))
curve(
pos=[
(0,0,4),
(1,0,4),
(1,1,4),
(-1,1,4),
(-1,-1,4),
(1,-1,4),
],
radius=3,
)
curve(
pos=[
(3,0,4),
(4,0,4),
(4,1,4),
(2,1,4),
(2,-1,4),
(4,-1,4),
],
color = [
(0,0,0),
(1,0,0),
(0,1,0),
(0,0,1),
(1,1,0),
(0,1,1),
],
radius=0,
)
scene._context.triggerRedraw(1)
Pingbacks
Pingbacks are closed.
Comments
Comments are closed.