1 #include "gl.h"
2 
3 #ifndef GL_STATE_H
4 #define GL_STATE_H
5 
6 #include "eval.h"
7 #include "texture.h"
8 
9 typedef struct {
10     GLboolean line_stipple,
11               blend,
12               color_array,
13               normal_array,
14               tex_coord_array,
15               texgen_s,
16               texgen_t,
17               texture_2d,
18               vertex_array;
19 } enable_state_t;
20 
21 
22 typedef struct {
23     GLenum S;
24     GLenum T;
25     GLfloat Sv[4];
26     GLfloat Tv[4];
27 } texgen_state_t;
28 
29 typedef struct {
30     GLuint unpack_row_length,
31            unpack_skip_pixels,
32            unpack_skip_rows;
33     GLboolean unpack_lsb_first;
34     // TODO: do we only need to worry about GL_TEXTURE_2D?
35     GLboolean rect_arb;
36     gltexture_t *bound;
37     khash_t(tex) *list;
38 } texture_state_t;
39 
40 
41 typedef struct {
42     GLint size;
43     GLenum type;
44     GLsizei stride;
45     const GLvoid *pointer;
46 } pointer_state_t;
47 
48 typedef struct {
49     pointer_state_t vertex, color, normal, tex_coord;
50 } pointer_states_t;
51 
52 
53 typedef struct {
54     renderlist_t *active;
55     renderlist_t *first;
56     GLboolean compiling;
57     GLboolean locked;
58     GLuint base;
59     GLuint name;
60     GLenum mode;
61 
62     GLuint count;
63     GLuint cap;
64 } displaylist_state_t;
65 
66 
67 typedef struct {
68     map_state_t *vertex3,
69                 *vertex4,
70                 *index,
71                 *color4,
72                 *normal,
73                 *texture1,
74                 *texture2,
75                 *texture3,
76                 *texture4;
77 } map_states_t;
78 
79 
80 typedef struct {
81     displaylist_state_t list;
82     enable_state_t enable;
83     map_state_t *map_grid;
84     map_states_t map1, map2;
85     pointer_states_t pointers;
86     renderlist_t **lists;
87     texgen_state_t texgen;
88     texture_state_t texture;
89     GLfloat color[4];
90 } glstate_t;
91 
92 #endif
93