Ejemplo n.º 1
0
    def __init__(self, win, zoom=1.0, phi=0, theta=0, nv=0.2):
        self.win = win
        self.tbcam = TrackballCamera(20.0)
        self.offset_x = 0
        self.offset_y = 0
        self.offset_z = 0

        self.matrix = (c_double * 16)()
        self.pmatrix = (c_double * 16)()
        self.viewport = (c_int * 4)()
Ejemplo n.º 2
0
    def __init__(self,width=defaults['width'],height=defaults['height']):
        self.width = width
        self.height = height
        self.config = Config(double_buffer=True, depth_size=24)
        self.win = window.Window(visible=True,resizable=True,
                                 config=self.config, caption='Sam')

        # set callbacks
        self.win.on_resize = self.on_resize
        self.win.on_draw = self.on_draw
        self.win.on_mouse_press = self.on_mouse_press
        self.win.on_mouse_drag = self.on_mouse_drag

        self.win.set_size(self.width,self.height)

        self.init_gl()
        
        self.tb = TrackballCamera(20.0)
        self.clnum = 1
        return
Ejemplo n.º 3
0
#!/usr/bin/env python
#
# a test of the trackball_camera class, showing basic usage in pyglet.
#
# by Roger Allen, July 2008
# [email protected]
#
from pyglet.gl import *
from pyglet import window
from trackball_camera import TrackballCamera

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
g_width = 800
g_height = 600
# >>>> INITIALIZE THE TRACKBALL CAMERA
g_tbcam = TrackballCamera(20.0)


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def to_glfloat_array(x):
    return (GLfloat * len(x))(*x)


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def init_gl():
    glEnable(GL_DEPTH_TEST)
    glDisable(GL_CULL_FACE)


# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def on_resize(width, height):