This implements an OpenGL drawing widget for painting 3D scenes.
ActorList objects have the following methods:
Redraw (some) actors in the scene.
This redraws the specified actors (recreating their display list). This should e.g. be used after changing an actor’s properties.
A collection of settings for an OpenGL Canvas.
Methods
Create a new set of CanvasSettings, possibly changing defaults.
Methods
CanvasSettings objects have the following methods:
Reset to defaults
If a dict is specified, these settings will override defaults.
Update current values with the specified settings
Returns the sanitized update values.
Light objects have the following methods:
An array of OpenGL lights.
Methods
Lights objects have the following methods:
A canvas for OpenGL rendering.
Methods
Initialize an empty canvas with default settings.
Methods
Canvas objects have the following methods:
Set the rendermode.
This changes the rendermode and redraws everything with the new mode.
Set the background color.
If one color is specified, a solid background is set. If two colors are specified, a graded background is set and an object is created to display the background.
Toggle the display of the global axes on or off.
If on is True, a triade of global axes is displayed, if False it is removed. The default (None) toggles between on and off.
(Re)display all the actors in the scene.
This should e.g. be used when actors are added to the scene, or after changing camera position/orientation or lens.
Set up the canvas for 2D drawing on top of 3D canvas.
The 2D drawing operation should be ended by calling end_2D_drawing. It is assumed that you will not try to change/refresh the normal 3D drawing cycle during this operation.
Remove a list of any actor/highlights/annotation/decoration items.
This will remove the items from any of the canvas lists in which the item appears. itemlist can also be a single item instead of a list.
Sets the camera looking under angles at bbox.
This function sets the camera angles and adjusts the zooming. The camera distance remains unchanged.
If a bbox is specified, the camera will be zoomed to make the whole bbox visible. If no bbox is specified, the current scene bbox will be used. If no current bbox has been set, it will be calculated as the bbox of the whole scene.
If no camera angles are given, the camera orientation is kept. angles can be a set of 3 angles, or a string
Rectangle zooming
x0,y0,x1,y1 are pixel coordinates of the lower left and upper right corners of the area to zoom to the full window
Rectangle zooming
x0,y0,x1,y1 are relative corners in (0,0)..(1,1) space
Draw the focus rectangle.
The specified width is HALF of the line width
Functions defined in the module canvas
- canvas.gl_pickbuffer()¶
- Return a list of the 2nd numbers in the openGL pick buffer.
- canvas.glFillMode(mode)¶
- canvas.glFrontFill()¶
- canvas.glBackFill()¶
- canvas.glBothFill()¶
- canvas.glFill()¶
- canvas.glLine()¶
- canvas.glLineSmooth(onoff)¶
- canvas.glSmooth()¶
- Enable smooth shading
- canvas.glFlat()¶
- Disable smooth shading
- canvas.onOff(onoff)¶
- Convert On/Off strings to a boolean
- canvas.glEnable(facility, onoff)¶
Enable/Disable an OpenGL facility, depending on onoff value
facility is an OpenGL facility. onoff can be True or False to enable, resp. disable the facility, or None to leave it unchanged.
- canvas.glCulling(onoff=True)¶
- canvas.glNoCulling()¶
- canvas.glLighting(onoff)¶
- canvas.glPolygonFillMode(mode)¶
- canvas.glPolygonMode(mode)¶
- canvas.glShadeModel(model)¶
- canvas.glSettings(settings)¶