1 ////////////////////////////////////////////////////////////////////////////////
2 //    Scorched3D (c) 2000-2011
3 //
4 //    This file is part of Scorched3D.
5 //
6 //    Scorched3D is free software; you can redistribute it and/or modify
7 //    it under the terms of the GNU General Public License as published by
8 //    the Free Software Foundation; either version 2 of the License, or
9 //    (at your option) any later version.
10 //
11 //    Scorched3D is distributed in the hope that it will be useful,
12 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //    GNU General Public License for more details.
15 //
16 //    You should have received a copy of the GNU General Public License along
17 //    with this program; if not, write to the Free Software Foundation, Inc.,
18 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ////////////////////////////////////////////////////////////////////////////////
20 
21 #if !defined(AFX_GLSTATE_H__32B0E2D0_566D_4438_94E4_B12FE82430B1__INCLUDED_)
22 #define AFX_GLSTATE_H__32B0E2D0_566D_4438_94E4_B12FE82430B1__INCLUDED_
23 
24 #define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
25 #include <GL/glew.h>
26 
27 class GLState
28 {
29 public:
30 	enum State
31 	{
32 		TEXTURE_ON = 0x1,
33 		TEXTURE_OFF = 0x2,
34 		BLEND_ON = 0x4,
35 		BLEND_OFF = 0x8,
36 		DEPTH_ON = 0x10,
37 		DEPTH_OFF = 0x20,
38 		CUBEMAP_ON = 0x40,
39 		CUBEMAP_OFF = 0x80,
40 		NORMALIZE_ON = 0x100,
41 		NORMALIZE_OFF = 0x200,
42 		LIGHTING_ON = 0x400,
43 		LIGHTING_OFF = 0x800,
44 		LIGHT1_ON = 0x1000,
45 		LIGHT1_OFF = 0x2000,
46 		ALPHATEST_ON = 0x4000,
47 		ALPHATEST_OFF = 0x8000
48 	};
49 
50 	GLState(unsigned wantedState);
51 	virtual ~GLState();
52 
53 	static void setBaseState(unsigned baseState);
54 	static const char *getStateString();
getState()55 	static unsigned int getState() { return currentState_; }
56 	static void setState(unsigned wanted);
57 
getStateSwitches()58 	static unsigned int getStateSwitches() { return stateSwitches_; }
resetStateSwitches()59 	static void resetStateSwitches() { stateSwitches_ = 0; }
60 
61 protected:
62 	static unsigned currentState_;
63 	static unsigned int stateSwitches_;
64 	unsigned returnState_;
65 
66 
67 };
68 
69 #endif // !defined(AFX_GLSTATE_H__32B0E2D0_566D_4438_94E4_B12FE82430B1__INCLUDED_)
70