| 1 | /* |
| 2 | Copyright (C) 2003 Rice1964 |
| 3 | |
| 4 | This program is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU General Public License |
| 6 | as published by the Free Software Foundation; either version 2 |
| 7 | of the License, or (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program; if not, write to the Free Software |
| 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | #ifndef _OGL_CONTEXT_H_ |
| 20 | #define _OGL_CONTEXT_H_ |
| 21 | |
| 22 | #include "typedefs.h" |
| 23 | #include "GraphicsContext.h" |
| 24 | |
| 25 | class COGLGraphicsContext : public CGraphicsContext |
| 26 | { |
| 27 | friend class OGLRender; |
| 28 | friend class COGLRenderTexture; |
| 29 | public: |
| 30 | virtual ~COGLGraphicsContext(); |
| 31 | |
| 32 | bool Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed ); |
| 33 | bool ResizeInitialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed ); |
| 34 | void CleanUp(); |
| 35 | void Clear(ClearFlag dwFlags, uint32 color=0xFF000000, float depth=1.0f); |
| 36 | |
| 37 | void UpdateFrame(bool swaponly=false); |
| 38 | int ToggleFullscreen(); // return 0 as the result is windowed |
| 39 | |
| 40 | bool IsExtensionSupported(const char* pExtName); |
| 41 | bool IsWglExtensionSupported(const char* pExtName); |
| 42 | static void InitDeviceParameters(); |
| 43 | |
| 44 | //Get methods (TODO, remove all friend class and use get methods instead) |
| 45 | bool IsSupportAnisotropicFiltering(); |
| 46 | int getMaxAnisotropicFiltering(); |
| 47 | |
| 48 | protected: |
| 49 | friend class OGLDeviceBuilder; |
| 50 | COGLGraphicsContext(); |
| 51 | void InitState(void); |
| 52 | void InitOGLExtension(void); |
| 53 | bool SetFullscreenMode(); |
| 54 | bool SetWindowMode(); |
| 55 | |
| 56 | // Important OGL extension features |
| 57 | bool m_bSupportMultiTexture; |
| 58 | bool m_bSupportTextureEnvCombine; |
| 59 | bool m_bSupportSeparateSpecularColor; |
| 60 | bool m_bSupportSecondColor; |
| 61 | bool m_bSupportFogCoord; |
| 62 | bool m_bSupportTextureObject; |
| 63 | |
| 64 | // Optional OGL extension features; |
| 65 | bool m_bSupportRescaleNormal; |
| 66 | bool m_bSupportLODBias; |
| 67 | bool m_bSupportAnisotropicFiltering; |
| 68 | int m_maxAnisotropicFiltering; |
| 69 | |
| 70 | // Nvidia OGL only features |
| 71 | bool m_bSupportTextureMirrorRepeat; |
| 72 | bool m_bSupportTextureLOD; |
| 73 | bool m_bSupportNVRegisterCombiner; |
| 74 | bool m_bSupportBlendColor; |
| 75 | bool m_bSupportBlendSubtract; |
| 76 | bool m_bSupportNVTextureEnvCombine4; |
| 77 | |
| 78 | // Minimal requirements, I will even not check them at runtime |
| 79 | //bool m_bSupportTextureEnvAdd; |
| 80 | //bool m_bSupportVertexArray; |
| 81 | |
| 82 | const unsigned char* m_pVendorStr; |
| 83 | const unsigned char* m_pRenderStr; |
| 84 | const unsigned char* m_pExtensionStr; |
| 85 | const char* m_pWglExtensionStr; |
| 86 | const unsigned char* m_pVersionStr; |
| 87 | }; |
| 88 | |
| 89 | #endif |
| 90 | |
| 91 | |
| 92 | |