File: stategl.h

package info (click to toggle)
searchandrescue 0.8.2-10
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,656 kB
  • ctags: 6,111
  • sloc: ansic: 89,072; cpp: 7,691; sh: 90; makefile: 80
file content (182 lines) | stat: -rw-r--r-- 3,684 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
			  OpenGL State Recording

	Functions to keep track of OpenGL states.
 */

#ifndef STATEGL_H
#define STATEGL_H


#ifdef __MSW__
# include <windows.h>
# include <GL/gl.h>
#endif

#ifndef True
# define True	1
#endif
#ifndef False
# define False	0
#endif

#define StateGLBoolean	unsigned char


/*
 *	GL state record struct:
 *
 *	When adding new states to this structure, be sure to update
 *	function SARGLStateResetAll(), StateGLEnable(), and
 *	StateGLDisable() to handle it
 *
 *	Plus create any additional functions to set specific function
 *	parameters
 */
typedef struct {

	/* Boolean values for each supported states */
	StateGLBoolean	alpha_test,
			blend,
			color_material,
			cull_face,
			depth_test,
			dither,
			fog,
			lighting,
			light0,
			light1,
			light2,
			light3,
			light4,
			light5,
			light6,
			light7,
			line_smooth,
			point_smooth,
			polygon_offset_fill,
			polygon_offset_line,
			polygon_offset_point,
			scissor_test,
			stencil_test,
			texture_1d,
			texture_2d,
			texture_3d,
			write_unbiased_depth;

	/* Alpha function state */
	GLenum		alpha_func_func;
	GLclampf	alpha_func_ref;

	/* Blend function state */
	GLenum		blend_func_sfactor,
			blend_func_dfactor;

	/* Color material parameters */
	GLenum		color_material_face,
			color_material_mode;

	/* Depth test function state */
	GLenum		depth_func_func;

	/* Depth buffer writing (GL_TRUE to enable) */
	GLboolean	depth_mask_flag;

	/* Front face cull winding */
	GLenum		front_face_mode;

	/* Line width */
	GLfloat		line_width;

	/* Point size */
	GLfloat		point_size;

	/* Polygon offset */
	GLfloat		polygon_offset_factor,
			polygon_offset_units;

	/* Scissor test */
	GLint		scissor_test_x,
			scissor_test_y;
	GLsizei		scissor_test_width,
			scissor_test_height;

	/* Shade model */
	GLenum		shade_model_mode;

	/* Stencil function */
	GLenum		stencil_func_func;
	GLint		stencil_func_ref;
	GLuint		stencil_func_mask;

	/* Stencil operation */
	GLenum		stencil_op_fail,
			stencil_op_zfail,
			stencil_op_zpass;

	/* Texture enviroment state */
	GLenum		tex_env_target, tex_env_pname;
	GLint		tex_env_param;


} state_gl_struct;
#define STATE_GL(p)	((state_gl_struct *)(p))


extern void StateGLEnableF(state_gl_struct *s, GLenum cap, GLboolean force);
extern void StateGLEnable(state_gl_struct *s, GLenum cap);
extern void StateGLDisableF(state_gl_struct *s, GLenum cap, GLboolean force);
extern void StateGLDisable(state_gl_struct *s, GLenum cap);

extern void StateGLAlphaFunc(
	state_gl_struct *s,
	GLenum func, GLclampf ref
);
extern void StateGLBlendFunc(
	state_gl_struct *s,
	GLenum sfactor, GLenum dfactor
);
extern void StateGLColorMaterial(
	state_gl_struct *s,
	GLenum face, GLenum mode
);
extern void StateGLDepthFunc(
	state_gl_struct *s, GLenum func
);
extern void StateGLDepthMask(  
	state_gl_struct *s, GLboolean flag
);
extern void StateGLFrontFace(
	state_gl_struct *s, GLenum mode
);
extern void StateGLLineWidth(
	state_gl_struct *s, GLfloat width
);
extern void StateGLPointSize(
	state_gl_struct *s, GLfloat size
);
extern void StateGLPolygonOffset(
	state_gl_struct *s, GLfloat factor, GLfloat units
);
extern void StateGLScissor(
	state_gl_struct *s, GLint x, GLint y, GLsizei width, GLsizei height
);
extern void StateGLShadeModel(
	state_gl_struct *s, GLenum mode
);
extern void StateGLStencilFunc(
	state_gl_struct *s, GLenum func, GLint ref, GLuint mask
);
extern void StateGLStencilOp(
	state_gl_struct *s, GLenum fail, GLenum zfail, GLenum zpass
);                      
extern void StateGLTexEnvI(
	state_gl_struct *s,
	GLenum target, GLenum pname, GLint param
);

extern void StateGLResetAll(state_gl_struct *s);



#endif	/* STATEGL_H */