108. opengl.canvas_settings
— This modules defines the CanvasSettings class¶
108.1. Classes defined in module opengl.canvas_settings¶
- class opengl.canvas_settings.Light(ambient=0.0, diffuse=0.0, specular=0.0, position=[0.0, 0.0, 1.0], enabled=True)[source]¶
A class representing an OpenGL light.
The light can emit 3 types of light: ambient, diffuse and specular, which can have different color and are all off by default.
- class opengl.canvas_settings.LightProfile(ambient, lights)[source]¶
A lightprofile contains all the lighting parameters.
Currently this consists off: - ambient: the global ambient lighting (currently a float) - lights: a list of 1 to 4 Lights
- class opengl.canvas_settings.Rendermode(fill: bool, smooth: bool, lighting: bool, wiremode: int, avgnormals: bool)[source]¶
Store the rendermode parameters in a single object
Currently this holds the following parameters:
fill: boolean
smooth: boolean (smooth/flat shading)
lighting: boolean (lights on/off)
wiremode: int 0..3 | None
avgnormals: boolean | None
The parameters can be set by a string value:
fill smooth wiremode avgnormals lighting wireframe F F None None flat T F 0 None flatwire T F 1 None flatbord T F 2 None flatfeat T F 3 None smooth T T 0 F smoothwire T T 1 F smoothbord T T 2 F smoothfeat T T 3 F smoothnorm T T 0 T
- class opengl.canvas_settings.CanvasSettings(**kargs)[source]¶
A collection of settings for an OpenGL Canvas.
The canvas settings are a collection of settings and default values affecting the rendering in an individual viewport. There are two type of settings:
mode settings are set during the initialization of the canvas and can/should not be changed during the drawing of actors and decorations;
default settings can be used as default values but may be changed during the drawing of actors/decorations: they are reset before each individual draw instruction.
Currently the following mode settings are defined:
bgmode: the viewport background color mode
bgcolor: the viewport background color: a single color or a list of colors (max. 4 are used).
bgimage: background image filename
alphablend: boolean (transparency on/off)
The list of default settings includes:
fgcolor: the default drawing color
bkcolor: the default backface color
slcolor: the highlight color
colormap: the default color map to be used if color is an index
bklormap: the default color map to be used if bkcolor is an index
textcolor: the default color for text drawing
culling: boolean
transparency: float (0.0..1.0)
pointsize: the default size for drawing points
marksize: the default size for drawing markers
linewidth: the default width for drawing lines
Any of these values can be set in the constructor using a keyword argument. All items that are not set, will get their value from the configuration file(s).
- reset(d={})[source]¶
Reset the CanvasSettings to its defaults.
The default values are taken from the configuration files. An optional dictionary may be specified to override (some of) these defaults.