2004-09-23 15:01:20 -04:00
\section { \class { wxGLContext} } \label { wxglcontext}
2005-04-08 10:34:30 -04:00
wxGLContext is a class for sharing OpenGL data resources, such as display lists, with another \helpref { wxGLCanvas} { wxglcanvas} .
2004-09-23 15:01:20 -04:00
By sharing data resources, you can prevent code duplication, save memory, and ultimately help optimize your application.
2004-09-23 15:16:08 -04:00
As an example, let's say you want to draw a ball on two different windows that is identical on each one, but the dimensions of one is slightly different than the other one. What you would do is create your display lists in the shared context, and then translate each ball on the individual canvas's context. This way the actual data for the ball is only created once (in the shared context), and you won't have to duplicate your development efforts on the second ball.
2004-09-23 15:01:20 -04:00
Note that some wxGLContext 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.
\wxheading { Derived from}
\helpref { wxObject} { wxobject}
\wxheading { Include files}
2004-09-23 16:20:53 -04:00
<wx/glcanvas.h>
\wxheading { See also}
2004-09-23 15:01:20 -04:00
\helpref { wxGLCanvas} { wxglcanvas}
\latexignore { \rtfignore { \wxheading { Members} } }
\membersection { wxGLContext::wxGLContext} \label { wxglcontextconstr}
\func { void} { wxGLContext} { \param { bool } { isRGB} , \param { wxGLCanvas*} { win} , \param { const wxPalette\& } { palette = wxNullPalette} }
\func { void} { wxGLContext} { \param { bool } { isRGB} , \param { wxGLCanvas*} { win} , \param { const wxPalette\& } { palette = wxNullPalette} ,
\param { const wxGLContext*} { other} }
\docparam { win} { Canvas to associate this shared context with.}
\docparam { other} { Context to share data resources with.}
\membersection { wxGLContext::GetWindow} \label { wxglcontextgetwindow}
\func { const wxWindow*} { GetWindow} { \void }
Obtains the window that is associated with this context.
\membersection { wxGLContext::SetCurrent} \label { wxglcontextsetcurrent}
\func { void} { SetCurrent} { \void }
Sets this context as the current recipient of OpenGL calls.
Each context contains an OpenGL device context that has been created during
the creation of this window. So this call sets the current device context
as the target device context for OpenGL operations.
\membersection { wxGLContext::SetColour} \label { wxglcontextsetcolour}
\func { void} { SetColour} { \param { const char*} { colour} }
Sets the current colour for this context, using the wxWidgets colour database to find a named colour.
\membersection { wxGLContext::SwapBuffers} \label { wxglcontextswapbuffers}
\func { void} { SwapBuffers} { \void }
Displays the previous OpenGL commands on the associated window.
2004-09-26 12:37:44 -04:00