2000-02-28 03:22:57 -05:00
\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.
2003-06-18 05:20:46 -04:00
To set up the attributes for the rendering context (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 { \it attribList} parameter. The values that should be set up and their meanings will be described below.
2003-05-08 19:46:34 -04:00
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.
2000-02-28 03:22:57 -05:00
\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} .
2003-06-18 05:20:46 -04:00
\wxheading { Constants}
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.
\twocolwidtha { 5cm}
\begin { twocollist} \itemsep =0pt
\twocolitem { \windowstyle { WX\_ GL\_ RGBA} } { Use true colour}
\twocolitem { \windowstyle { WX\_ GL\_ BUFFER\_ SIZE} } { Bits for buffer if not WX\_ GL\_ RGBA}
\twocolitem { \windowstyle { WX\_ GL\_ LEVEL} } { 0 for main buffer, >0 for overlay, <0 for underlay}
\twocolitem { \windowstyle { WX\_ GL\_ DOUBLEBUFFER} } { Use doublebuffer}
\twocolitem { \windowstyle { WX\_ GL\_ STEREO} } { Use stereoscopic display}
\twocolitem { \windowstyle { WX\_ GL\_ AUX\_ BUFFERS} } { Number of auxiliary buffers (not all implementation support this option)}
\twocolitem { \windowstyle { WX\_ GL\_ MIN\_ RED} } { Use red buffer with most bits (> MIN\_ RED bits)}
\twocolitem { \windowstyle { WX\_ GL\_ MIN\_ GREEN} } { Use green buffer with most bits (> MIN\_ GREEN bits) }
\twocolitem { \windowstyle { WX\_ GL\_ MIN\_ BLUE} } { Use blue buffer with most bits (> MIN\_ BLUE bits) }
\twocolitem { \windowstyle { WX\_ GL\_ MIN\_ ALPHA} } { Use alpha buffer with most bits (> MIN\_ ALPHA bits)}
\twocolitem { \windowstyle { WX\_ GL\_ DEPTH\_ SIZE} } { Bits for Z-buffer (0,16,32)}
\twocolitem { \windowstyle { WX\_ GL\_ STENCIL\_ SIZE} } { Bits for stencil buffer}
\twocolitem { \windowstyle { WX\_ GL\_ MIN\_ ACCUM\_ RED} } { Use red accum buffer with most bits (> MIN\_ ACCUM\_ RED bits)}
\twocolitem { \windowstyle { WX\_ GL\_ MIN\_ ACCUM\_ GREEN} } { Use green buffer with most bits (> MIN\_ ACCUM\_ GREEN bits)}
\twocolitem { \windowstyle { WX\_ GL\_ MIN\_ ACCUM\_ BLUE} } { Use blue buffer with most bits (> MIN\_ ACCUM\_ BLUE bits)}
\twocolitem { \windowstyle { WX\_ GL\_ MIN\_ ACCUM\_ ALPHA} } { Use blue buffer with most bits (> MIN\_ ACCUM\_ ALPHA bits)}
\end { twocollist}
2000-02-28 03:22:57 -05:00
\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.
2003-06-18 05:20:46 -04:00
\docparam { parent} { Pointer to a parent window.}
\docparam { id} { Window identifier. If -1, will automatically create an identifier.}
\docparam { pos} { Window position. wxDefaultPosition is (-1, -1) which indicates that wxWindows
should generate a default position for the window.}
\docparam { size} { Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows 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.}
\docparam { style} { Window style.}
\docparam { name} { Window name.}
\docparam { attribList} { Array of int. 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\_ GL\_ DEPTH\_ SIZE should be followed by the value that indicates the number of
bits for the depth buffer, so:
\begin { verbatim}
attribList[index]= WX_ GL_ DEPTH_ SIZE;
attribList[index+1]=32;
and so on.
\end { verbatim}
}
\docparam { palette} { If the window has the palette, it should by pass this value.
Note: palette and WX\_ GL\_ RGBA are mutually exclusive.}
2000-02-28 03:22:57 -05:00
\membersection { wxGLCanvas::SetCurrent} \label { wxglcanvassetcurrent}
\func { void} { SetCurrent} { \void }
Sets this canvas as the current recipient of OpenGL calls.
2003-06-18 05:20:46 -04:00
Each canvas contain 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.
2000-02-28 03:22:57 -05:00
\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.