Inheritance diagram for wx.glcanvas.GLCanvas:
wx.glcanvas.GLCanvas is a class for displaying OpenGL graphics.
There are two ways to use this class:
To set up the attributes for the canvas (number of bits for the depth buffer, number of bits for the stencil buffer and so on) you should set up the correct values of the attribList parameter. The values that should be set up and their meanings will be described below.
To switch on wx.glcanvas.GLCanvas support on under Windows, edit setup.h and set wx.USE_GLCANVAS to 1.
You may also need to have to add opengl32.lib to the list of libraries your program is linked with.
On Unix, pass --with-opengl to configure to compile using OpenGL or Mesa.
See also
The generic GL implementation doesn’t support many of these options, such as stereo, auxiliary buffers, alpha channel, and accum buffer. Other implementations may support them.
Constant | Description |
---|---|
wx.glcanvas.WX_GL_RGBA | Use true colour |
wx.glcanvas.WX_GL_BUFFER_SIZE | Bits for buffer if not wx.glcanvas.WX_GL_RGBA |
wx.glcanvas.WX_GL_LEVEL | 0 for main buffer, >0 for overlay, <0 for underlay |
wx.glcanvas.WX_GL_DOUBLEBUFFER | Use doublebuffer |
wx.glcanvas.WX_GL_STEREO | Use stereoscopic display |
wx.glcanvas.WX_GL_AUX_BUFFERS | Number of auxiliary buffers (not all implementation support this option) |
wx.glcanvas.WX_GL_MIN_RED | Use red buffer with most bits (> MIN_RED bits) |
wx.glcanvas.WX_GL_MIN_GREEN | Use green buffer with most bits (> MIN_GREEN bits) |
wx.glcanvas.WX_GL_MIN_BLUE | Use blue buffer with most bits (> MIN_BLUE bits) |
wx.glcanvas.WX_GL_MIN_ALPHA | Use alpha buffer with most bits (> MIN_ALPHA bits) |
wx.glcanvas.WX_GL_DEPTH_SIZE | Bits for Z-buffer (0, 16, 32) |
wx.glcanvas.WX_GL_STENCIL_SIZE | Bits for stencil buffer |
wx.glcanvas.WX_GL_MIN_ACCUM_RED | Use red accum buffer with most bits (> MIN_ACCUM_RED bits) |
wx.glcanvas.WX_GL_MIN_ACCUM_GREEN | Use green buffer with most bits (> MIN_ACCUM_GREEN bits) |
wx.glcanvas.WX_GL_MIN_ACCUM_BLUE | Use blue buffer with most bits (> MIN_ACCUM_BLUE bits) |
wx.glcanvas.WX_GL_MIN_ACCUM_ALPHA | Use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) |
Constructor.
Parameters:
parent (wx.Window): Pointer to a parent window.
id (int): Window identifier. If -1, will automatically create an identifier.
pos (wx.Point): Window position. wx.DefaultPosition is (-1, -1) which indicates that wxPython should generate a default position for the window.
size (wx.Size): Window size. wx.DefaultSize is (-1, -1) which indicates that wxPython should generate a default size for the window. If no suitable size can be found, the window will be sized to 20x20 pixels so that the window is visible but obviously not correctly sized.
style (long): Window style.
name (string): Window name.
attribList (list of integers): With this parameter you can set the device context attributes associated to this window. This array is zero-terminated: it should be set up with constants described in the table above. If a constant should be followed by a value, put it in the next array position. For example, the wx.glcanvas.WX_GL_DEPTH_SIZE should be followed by the value that indicates the number of bits for the depth buffer, so:
attribList[index]= wx.glcanvas.WX_GL_DEPTH_SIZE
attribList[index+1] = 32
and so on.
palette (wx.Palette)
Returns:
Obtains the context that is associated with this canvas if one was implicitly created (by use of one of the first three constructors).
Always returns None if the canvas was constructed with the fourth constructor.
Returns:
Sets the current colour for this window, using the wxPython colour database to find a named colour.
Parameters:
A call to this method makes the OpenGL state that is represented by the OpenGL rendering context RC current with this canvas, and if win is an object of type wx.glcanvas.GLCanvas, the statements:
win.SetCurrent(RC)
and:
RC.SetCurrent(win)
are equivalent.
Parameters:
Note
Note that this function may only be called after the window has been shown.
See also
Parameters:
Parameters: