\section{\class{wxGLCanvas}}\label{wxglcanvas}

wxGLCanvas is a class for displaying OpenGL graphics. There are
wrappers for OpenGL on Windows, and GTK+ and Motif.

To use this class, create a wxGLCanvas window, call \helpref{wxGLCanvas::SetCurrent}{wxglcanvassetcurrent} 
to direct normal OpenGL commands to the window, and then call \helpref{wxGLCanvas::SwapBuffers}{wxglcanvasswapbuffers} 
to show the OpenGL buffer on the window.

To switch wxGLCanvas support on under Windows, edit setup.h and set
{\tt wxUSE\_GLCANVAS} to $1$. You may also need to have to add
{\tt opengl32.lib} to the list of libraries your program is linked with. On
Unix, pass {\tt --with-opengl} to configure to compile using OpenGL or Mesa.

\wxheading{Derived from}

\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}

\wxheading{Include files}

<wx/glcanvas.h>

\wxheading{Window styles}

There are no specific window styles for this class.

See also \helpref{window styles overview}{windowstyles}.

\latexignore{\rtfignore{\wxheading{Members}}}

\membersection{wxGLCanvas::wxGLCanvas}\label{wxglcanvasconstr}

\func{void}{wxGLCanvas}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id = -1}, \param{const wxPoint\&}{ pos},
 \param{const wxSize\&}{ size}, \param{long}{ style=0}, \param{const wxString\& }{name="GLCanvas"},
 \param{int*}{ attribList = 0}, \param{const wxPalette\&}{ palette = wxNullPalette}}

\func{void}{wxGLCanvas}{\param{wxWindow* }{parent}, \param{wxGLCanvas* }{ sharedCanvas = NULL}, \param{wxWindowID}{ id = -1}, \param{const wxPoint\&}{ pos},
 \param{const wxSize\&}{ size}, \param{long}{ style=0}, \param{const wxString\& }{name="GLCanvas"},
 \param{int*}{ attribList = 0}, \param{const wxPalette\&}{ palette = wxNullPalette}}

\func{void}{wxGLCanvas}{\param{wxWindow* }{parent}, \param{wxGLContext* }{ sharedContext = NULL}, \param{wxWindowID}{ id = -1}, \param{const wxPoint\&}{ pos},
 \param{const wxSize\&}{ size}, \param{long}{ style=0}, \param{const wxString\& }{name="GLCanvas"},
 \param{int*}{ attribList = 0}, \param{const wxPalette\&}{ palette = wxNullPalette}}

Constructor.

\membersection{wxGLCanvas::SetCurrent}\label{wxglcanvassetcurrent}

\func{void}{SetCurrent}{\void}

Sets this canvas as the current recipient of OpenGL calls.

\membersection{wxGLCanvas::SetColour}\label{wxglcanvassetcolour}

\func{void}{SetColour}{\param{const char*}{ colour}}

Sets the current colour for this window, using the wxWindows colour database to find a named colour.

\membersection{wxGLCanvas::SwapBuffers}\label{wxglcanvasswapbuffers}

\func{void}{SwapBuffers}{\void}

Displays the previous OpenGL commands on the window.

