# wxGLContext Class Reference
[OpenGL]

`#include <wx/glcanvas.h>`

Inheritance diagram for wxGLContext:
[legend]

## Detailed Description

An instance of a wxGLContext 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 wxGLCanvas however works only if the other wxGLCanvas was created with the same attributes as the wxGLCanvas from which the wxGLContext was initialized. (This applies to sharing display lists among contexts analogously.)

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.

wxHAS_OPENGL_ES is defined on platforms that only have this implementation available (eg the iPhone) und don't support the full specification.

##

Library: wxGL

Category: OpenGL

See also:
  wxGLCanvas

## Public Member Functions
| wxGLContext (wxGLCanvas *win, const wxGLContext *other=NULL)
| Constructor.
virtual bool | SetCurrent (const wxGLCanvas &win) const
| Makes the OpenGL state that is represented by this rendering context current with the wxGLCanvas win.

List of all members.

## Constructor & Destructor Documentation

wxGLContext::wxGLContext | ( | wxGLCanvas * | win,
|  | const wxGLContext * | other = `NULL` |
| ) |  |  |

Constructor.

Parameters:

  | win | The canvas that is used to initialize this context. This parameter is needed only temporarily, and the caller may do anything with it (e.g. destroy the window) after the constructor returned. It will be possible to bind (make current) this context to any other wxGLCanvas that has been created with equivalent attributes as win.
  | other | Context to share display lists with or NULL (the default) for no sharing.

## Member Function Documentation

virtual bool wxGLContext::SetCurrent | ( | const wxGLCanvas & | win | ) | const`[virtual]`

Makes the OpenGL state that is represented by this rendering context current with the wxGLCanvas win.

Note:
  win can be a different wxGLCanvas window than the one that was passed to the constructor of this rendering context. If RC is an object of type wxGLContext, the statements "RC.SetCurrent(win);" and "win.SetCurrent(RC);" are equivalent, see wxGLCanvas::SetCurrent().

|  | [ top ]