www.pudn.com > Gimcrack-v0.0051-Source.zip > opengl.h
#ifndef _OPENGL_H_ #define _OPENGL_H_ #include#include #include #include #include "../singleton.h" static PIXELFORMATDESCRIPTOR m_pfd; class GcOpenGL : public Singleton { public: GcOpenGL(); ~GcOpenGL(); // Intialize / shut down open gl bool Init( HWND hParent, int width, int height, int depth ); bool Close(); // Set the view mode of the screen void SetPerspective(int iWidth, int iHeight); // Clear the screen / flip the buffers void Clear() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); } void Flip() { glFlush(); SwapBuffers(hDC); } bool HasVertexArraySupport() { return m_vertexArraySupport; } bool HasMultiTextureSupport() { return m_multiTextureSupport; } bool HasFogSupport() { return m_fogSupport; } HWND GetWindowHandle() { return m_hWnd; } private: bool SetupPixelFormat(); bool SetupGLWindow(); void SetupGLState(); void SetupMultitexturing(); void SetupFog(); void SetupVertexArrayRange(); bool CheckSupport( char * check, char * str ); HGLRC hRC; HDC hDC; HWND m_hWnd; GLuint iPixelFormat; int m_screenWidth; int m_screenHeight; int m_screenDepth; // FIXME: Convert to hash table bool m_multiTextureSupport; bool m_vertexArraySupport; bool m_fogSupport; }; #endif