An instance of a wx.glcanvas.GLContext represents the state of an OpenGL state machine and the connection between OpenGL and the system.
The OpenGL state includes everything that can be set with the OpenGL API: colors, rendering variables, display lists, texture objects, etc. Although it is possible to have multiple rendering contexts share display lists in order to save resources, this method is hardly used today any more, because display lists are only a tiny fraction of the overall state.
Therefore, one rendering context is usually used with or bound to multiple output windows in turn, so that the application has access to the complete and identical state while rendering into each window.
Binding (making current) a rendering context with another instance of a wx.glcanvas.GLCanvas however works only if the other wx.glcanvas.GLCanvas was created with the same attributes as the wx.glcanvas.GLCanvas from which the wx.glcanvas.GLContext was initialized. (This applies to sharing display lists among contexts analogously.)
Note that some wx.glcanvas.GLContext features are extremely platform-specific - its best to check your native platform’s glcanvas header (on windows include/wx/msw/glcanvas.h) to see what features your native platform provides.
HAS_OPENGL_ES
is defined on platforms that only have this implementation available (eg the iPhone) und don’t support the full specification.
See also
__init__ |
Constructor. |
SetCurrent |
Makes the OpenGL state that is represented by this rendering context current with the wx.glcanvas.GLCanvas win. |
wx.glcanvas.
GLContext
(Object)¶Possible constructors:
GLContext(win, other=None)
An instance of a GLContext represents the state of an OpenGL state machine and the connection between OpenGL and the system.
__init__
(self, win, other=None)¶Constructor.
Parameters: |
|
---|
SetCurrent
(self, win)¶Makes the OpenGL state that is represented by this rendering context current with the wx.glcanvas.GLCanvas win.
Parameters: | win (wx.glcanvas.GLCanvas) – |
---|---|
Return type: | bool |
Note
win can be a different wx.glcanvas.GLCanvas window than the one that was passed to the constructor of this rendering context. If RC
is an object of type wx.glcanvas.GLContext, the statements “RC.SetCurrent(win);” and “win.SetCurrent(RC);” are equivalent, see wx.glcanvas.GLCanvas.SetCurrent
.