class GL.GLView(Component, ViewBase)
The GLView class of the GL submodule provides an area
for displaying 3D graphics using OpenGL. It also provides model observation
and input handling facilities via the ViewBase class.
Constructors
- GLView(config, share_group = None)
GLView(config_attr = value..., share_group = None)
- Creates a GLView having the given characteristics.
In the first form of the constructor, the characteristics are specified
by a GLConfig instance. In the second form, attributes of the GLConfig
class are specified as individual keyword arguments to the constructor.
- If share_group is specified, it should be a ShareGroup instance, and the GLView is added to that group.
Abstract methods
- init_context()
- Immediately after the view's OpenGL context is created, it is made
the current context and this method is called. You may use this method to
establish any desired initial OpenGL state.
- viewport_changed()
- This method is called after init_context() during creation
of the GLView, and again whenever the size of the view changes. When called,
the view's OpenGL context is the current context, and its viewport has been
set to (0, 0, w, h) where (w, h) is the new
size of the view. You may use this method to establish the desired projection.
- render()
- This method is called with the view's OpenGL context as the current
context whenever the view needs to be redrawn. On return, drawing will be
flushed and buffers swapped as appropriate.
Methods
- with_context(function, flush = True)
- The function should be a callable object of no arguments.
Calls function with the view's OpenGL context as the current context. If flush is true, then after calling the function, a buffer flush or swap is performed as appropriate.
- invalidate()
- Marks the whole view as needing to be redrawn.
- update()
- Causes the whole view to be redrawn immediately, without waiting
for a return to the event loop.
---