0001:
0002:
0003:
0004:
0005:
0006:
0007:
0008: #pragma once
0009:
0010: namespace tpot
0011: {
0012: class CGl
0013: {
0014: private:
0015: HWND _hWnd;
0016: HDC _hDC;
0017: HGLRC _hglrc;
0018:
0019: int SetupPixelFormat( HDC hdc );
0020: public:
0021:
0022: CGl( HWND hWnd );
0023: ~CGl();
0024:
0025: void BeginRender();
0026: void EndRender();
0027:
0028: void SetCurrent();
0029: };
0030:
0031:
0032: inline void CGl::SetCurrent()
0033: {
0034: wglMakeCurrent( _hDC, _hglrc );
0035: }
0036:
0037: inline void CGl::BeginRender()
0038: {
0039: wglMakeCurrent( _hDC, _hglrc );
0040: }
0041:
0042: inline void CGl::EndRender()
0043: {
0044: SwapBuffers( _hDC );
0045: wglMakeCurrent( _hDC, 0);
0046: }
0047: }
0048: