3 Copyright (C) 2003 Rice1964
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #define M64P_PLUGIN_PROTOTYPES 1
22 #include "m64p_plugin.h"
23 #include "m64p_vidext.h"
25 #include "FrameBuffer.h"
26 #include "OGLGraphicsContext.h"
29 CGraphicsContext* CGraphicsContext::g_pGraphicsContext = NULL;
30 bool CGraphicsContext::m_deviceCapsIsInitialized = false;
31 bool CGraphicsContext::needCleanScene = false;
32 int CGraphicsContext::m_maxFSAA = 16;
33 int CGraphicsContext::m_maxAnisotropy = 16;
35 CGraphicsContext * CGraphicsContext::Get(void)
37 return CGraphicsContext::g_pGraphicsContext;
40 CGraphicsContext::CGraphicsContext() :
41 m_supportTextureMirror(false),
47 CGraphicsContext::~CGraphicsContext()
49 g_pFrameBufferManager->CloseUp();
52 uint32 CGraphicsContext::m_dwWindowStyle=0; // Saved window style for mode switches
53 uint32 CGraphicsContext::m_dwWindowExStyle=0; // Saved window style for mode switches
54 uint32 CGraphicsContext::m_dwStatusWindowStyle=0; // Saved window style for mode switches
56 void CGraphicsContext::InitWindowInfo()
60 bool CGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed)
62 m_bWindowed = (bWindowed != 0);
64 g_pFrameBufferManager->Initialize();
68 bool CGraphicsContext::ResizeInitialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed )
73 void CGraphicsContext::CleanUp()
80 int __cdecl SortFrequenciesCallback( const void* arg1, const void* arg2 )
82 unsigned int* p1 = (unsigned int*)arg1;
83 unsigned int* p2 = (unsigned int*)arg2;
92 int __cdecl SortResolutionsCallback( const void* arg1, const void* arg2 )
94 unsigned int* p1 = (unsigned int*)arg1;
95 unsigned int* p2 = (unsigned int*)arg2;
105 else if( p1[1] > p2[1] )
112 // This is a static function, will be called when the plugin DLL is initialized
113 void CGraphicsContext::InitDeviceParameters(void)
115 // To initialze device parameters for OpenGL
116 COGLGraphicsContext::InitDeviceParameters();