Class OGLCanvas
About :
The OGLCanvas class implements the observation of a scene OGLCanvas_ implementation with glfw it is associated with an openGL context that can be shared by several canvas
Functions
Function | summury |
---|---|
__init__(self, parent, name=’GL window’, shared_canvas=None, at_init=None, stereo=False, app=None) | |
new_gl_context(self) | Get the open gl context of this canvas (more…) |
set_current_gl_context(self) | Associate open gl context as current for any openGL action (more…) |
get_gl_context(self) | Get the open gl context of this canvas (more…) |
set_gray_scale(self, enable=True) | set render to grayscale (more…) |
on_exit(self, event) | internal callback called whenever the canvas is destroyed : the application exits (more…) |
get_size(self) | get current size of the window where the canvas is drawn (more…) |
show(self, show=True) | |
set_window_size(self, size=(600, 300)) | set window size (more…) |
activate_keyboard(self, activate=True) | activate keyboard callback (more…) |
on_keyboard(self, key=None, ukey=None, ctrl=False, shift=False, alt=False, cmd=False, meta=False, x=0, y=0) | internal callback called whenever the keyboard is activated (more…) |
activate_mouse(self, motion=True, left=True, middle=True, right=True, wheel=True) | activate mouse callback (more…) |
on_mouse_button(self, button, down, x, y) | Transfer event towards OGLApp on_mouse button event (more…) |
on_mouse_motion(self, x, y) | Transfer event towards OGLApp on_mouse motion event (more…) |
on_mouse_wheel(self, xoffset, yoffset, x, y) | Transfer event towards OGLApp on_mouse motion event (more…) |
Methods desciption :
init
def __init__(self, parent, name='GL window', shared_canvas=None, at_init=None, stereo=False, app=None)
new_gl_context
def new_gl_context(self)
Get the open gl context of this canvas
- ← a new canvas context
set_current_gl_context
def set_current_gl_context(self)
Associate open gl context as current for any openGL action It make this canvas currently concerned by OpenGL Calls
get_gl_context
def get_gl_context(self)
Get the open gl context of this canvas
- ← the canvas context
set_gray_scale
def set_gray_scale(self, enable=True)
set render to grayscale
- → enable : boolean
on_exit
def on_exit(self, event)
internal callback called whenever the canvas is destroyed : the application exits
get_size
def get_size(self)
get current size of the window where the canvas is drawn
returns: w,h (tuple) width and height of the canvas
show
def show(self, show=True)
set_window_size
def set_window_size(self, size=(600, 300))
set window size
- → size : 2 entry tuple =(width,height)
activate_keyboard
def activate_keyboard(self, activate=True)
activate keyboard callback
- → activate : boolean
on_keyboard
def on_keyboard(self, key=None, ukey=None, ctrl=False, shift=False, alt=False, cmd=False, meta=False, x=0, y=0)
internal callback called whenever the keyboard is activated
Indeed the keyboard event is redirected a single callback associated with th OGLApp
activate_mouse
def activate_mouse(self, motion=True, left=True, middle=True, right=True, wheel=True)
activate mouse callback
- → motion : mouse motion is tracked
- → left : left button is tracked
- → middle : middle button is tracked
- → right : right button is tracked
- → wheel : wheel button is tracked
on_mouse_button
def on_mouse_button(self, button, down, x, y)
Transfer event towards OGLApp on_mouse button event
- → button == 0 : left, 1 : middle, 3 : right
- → mode == pass True for Down
- → x,y == x,y position in the window
on_mouse_motion
def on_mouse_motion(self, x, y)
Transfer event towards OGLApp on_mouse motion event
- → x,y == x,y position in the window
on_mouse_wheel
def on_mouse_wheel(self, xoffset, yoffset, x, y)
Transfer event towards OGLApp on_mouse motion event
- → x,y == x,y position in the window