2 Copyright (C) 2003 Rice1964
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.
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.
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.
28 CLEAR_COLOR_BUFFER=0x01,
29 CLEAR_DEPTH_BUFFER=0x02,
30 CLEAR_COLOR_AND_DEPTH_BUFFER=0x03,
36 uint32 addr; //N64 RDRAM address
37 uint32 size; //N64 buffer size
38 uint32 format; //N64 format
41 } TextureBufferShortInfo;
44 // This class basically provides an extra level of security for our
45 // multithreaded code. Threads can Grab the CGraphicsContext to prevent
46 // other threads from changing/releasing any of the pointers while it is
49 // It is based on CCritSect for Lock() and Unlock()
51 class CGraphicsContext : public CCritSect
53 friend class CDeviceBuilder;
56 bool Ready() { return m_bReady; }
57 bool IsWindowed() {return m_bWindowed;}
59 virtual bool Initialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed );
60 virtual bool ResizeInitialize(uint32 dwWidth, uint32 dwHeight, BOOL bWindowed );
61 virtual void CleanUp();
63 virtual void Clear(ClearFlag flags, uint32 color=0xFF000000, float depth=1.0f) = 0;
64 virtual void UpdateFrame(bool swaponly=false) = 0;
65 virtual int ToggleFullscreen()=0; // return 0 as the result is windowed
67 static void InitWindowInfo();
68 static void InitDeviceParameters();
70 bool m_supportTextureMirror;
74 static int m_maxAnisotropy;
77 static uint32 m_dwWindowStyle; // Saved window style for mode switches
78 static uint32 m_dwWindowExStyle; // Saved window style for mode switches
79 static uint32 m_dwStatusWindowStyle; // Saved window style for mode switches
81 static bool m_deviceCapsIsInitialized;
87 RECT m_rcWindowBounds;
89 char m_strDeviceStats[256];
91 virtual ~CGraphicsContext();
95 static CGraphicsContext *g_pGraphicsContext;
96 static CGraphicsContext * Get(void);
97 inline const char* GetDeviceStr() {return m_strDeviceStats;}
98 static bool needCleanScene;