GLRC glrc; // inside window creation glrc.Create(wnd); // before rendering into window glrc.MakeCurrent(); // ... // display in the screen (in case of double buffering) glrc.SwapBuffers(); // .. // delete gl context (may be avoided, because called in destructor anyway) glrc.Destroy();
#include <gmlglrc.h>
Public Member Functions | |
Class Construction/Destruction | |
GLRC (HWND wnd) | |
Constructor from Window Handle (HWND). | |
GLRC (HDC hdc) | |
Constructor form Device Context Handle(HDC). | |
void | Destroy () |
Destory GL context (also called in destructor). | |
virtual | ~GLRC () |
Context members | |
virtual bool | Create () |
Member, needed to create context. Call this before use of OpenGL. | |
bool | IsCurrent () const |
Member, that return true if opengl is ready to draw. | |
bool | MakeCurrent () |
Prepare current context for use. | |
void | SwapBuffers () |
Call this insted of opengl's swap buffer, at the end of the drawing. | |
Protected Attributes | |
bool | m_created |
true inside Create() / Destory() pair | |
HWND | m_wnd |
Window handle. | |
HDC | m_dc |
Device Context handle. | |
HGLRC | m_glrc |
OpenGL Context handle. |
GLRC glrc; // inside window creation glrc.Create(wnd); // before rendering into window glrc.MakeCurrent(); // ... // display in the screen (in case of double buffering) glrc.SwapBuffers(); // .. // delete gl context (may be avoided, because called in destructor anyway) glrc.Destroy();
|
Virtual Destructor |