Contents Up Previous Next

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 wxGLCanvas::SetCurrent to direct normal OpenGL commands to the window, and then call wxGLCanvas::SwapBuffers to show the OpenGL buffer on the window.

Please note that despite deriving from wxScrolledWindow, scrolling is not enabled for this class under Windows.

To switch wxGLCanvas support on under Windows, edit setup.h and set wxUSE_GLCANVAS to 1. On Unix, pass --with-opengl to configure to compile using OpenGL or Mesa.

Derived from

wxScrolledWindow
wxWindow
wxEvtHandler
wxObject

Include files

<wx/glcanvas.h>

Window styles

There are no specific window styles for this class.

See also window styles overview.

Members

wxGLCanvas::wxGLCanvas
wxGLCanvas::SetCurrent
wxGLCanvas::SetColour
wxGLCanvas::SwapBuffers


wxGLCanvas::wxGLCanvas

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

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

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

Constructor.


wxGLCanvas::SetCurrent

void SetCurrent()

Sets this canvas as the current recipient of OpenGL calls.


wxGLCanvas::SetColour

void SetColour(const char* colour)

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


wxGLCanvas::SwapBuffers

void SwapBuffers()

Displays the previous OpenGL commands on the window.