Path: blob/master/libmupen64plus/mupen64plus-video-rice/src/GraphicsContext.cpp
2 views
/*12Copyright (C) 2003 Rice196434This program is free software; you can redistribute it and/or5modify it under the terms of the GNU General Public License6as published by the Free Software Foundation; either version 27of the License, or (at your option) any later version.89This program is distributed in the hope that it will be useful,10but WITHOUT ANY WARRANTY; without even the implied warranty of11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12GNU General Public License for more details.1314You should have received a copy of the GNU General Public License15along with this program; if not, write to the Free Software16Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.1718*/1920#define M64P_PLUGIN_PROTOTYPES 121#include "m64p_plugin.h"22#include "m64p_vidext.h"2324#include "FrameBuffer.h"25#include "OGLGraphicsContext.h"26#include "Video.h"2728CGraphicsContext* CGraphicsContext::g_pGraphicsContext = NULL;29bool CGraphicsContext::m_deviceCapsIsInitialized = false;30bool CGraphicsContext::needCleanScene = false;31int CGraphicsContext::m_maxFSAA = 16;32int CGraphicsContext::m_maxAnisotropy = 16;3334CGraphicsContext * CGraphicsContext::Get(void)35{36return CGraphicsContext::g_pGraphicsContext;37}3839CGraphicsContext::CGraphicsContext() :40m_supportTextureMirror(false),41m_bReady(false),42m_bActive(false),43m_bWindowed(true)44{45}46CGraphicsContext::~CGraphicsContext()47{48g_pFrameBufferManager->CloseUp();49}5051uint32 CGraphicsContext::m_dwWindowStyle=0; // Saved window style for mode switches52uint32 CGraphicsContext::m_dwWindowExStyle=0; // Saved window style for mode switches53uint32 CGraphicsContext::m_dwStatusWindowStyle=0; // Saved window style for mode switches5455void CGraphicsContext::InitWindowInfo()56{57}5859bool CGraphicsContext::Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed)60{61m_bWindowed = (bWindowed != 0);6263g_pFrameBufferManager->Initialize();64return true;65}6667bool CGraphicsContext::ResizeInitialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed )68{69return true;70}7172void CGraphicsContext::CleanUp()73{74m_bActive = false;75m_bReady = false;76}777879int __cdecl SortFrequenciesCallback( const void* arg1, const void* arg2 )80{81unsigned int* p1 = (unsigned int*)arg1;82unsigned int* p2 = (unsigned int*)arg2;8384if( *p1 < *p2 )85return -1;86else if( *p1 > *p2 )87return 1;88else89return 0;90}91int __cdecl SortResolutionsCallback( const void* arg1, const void* arg2 )92{93unsigned int* p1 = (unsigned int*)arg1;94unsigned int* p2 = (unsigned int*)arg2;9596if( *p1 < *p2 )97return -1;98else if( *p1 > *p2 )99return 1;100else101{102if( p1[1] < p2[1] )103return -1;104else if( p1[1] > p2[1] )105return 1;106else107return 0;108}109}110111// This is a static function, will be called when the plugin DLL is initialized112void CGraphicsContext::InitDeviceParameters(void)113{114// To initialze device parameters for OpenGL115COGLGraphicsContext::InitDeviceParameters();116}117118119120