+typedef struct gl_bufferobjectinfo_s
+{
+ int target;
+ int object;
+ size_t size;
+ char name[MAX_QPATH];
+}
+gl_bufferobjectinfo_t;
+
+typedef struct gltextureunit_s
+{
+ const void *pointer_texcoord;
+ size_t pointer_texcoord_offset;
+ int pointer_texcoord_buffer;
+ int t2d, t3d, tcubemap, trectangle;
+ int arrayenabled;
+ unsigned int arraycomponents;
+ int rgbscale, alphascale;
+ int combinergb, combinealpha;
+ // texmatrixenabled exists only to avoid unnecessary texmatrix compares
+ int texmatrixenabled;
+ matrix4x4_t matrix;
+}
+gltextureunit_t;
+
+typedef struct gl_state_s
+{
+ int cullface;
+ int cullfaceenable;
+ int blendfunc1;
+ int blendfunc2;
+ int blend;
+ GLboolean depthmask;
+ int colormask; // stored as bottom 4 bits: r g b a (3 2 1 0 order)
+ int depthtest;
+ float depthrange[2];
+ float polygonoffset[2];
+ int alphatest;
+ int scissortest;
+ unsigned int unit;
+ unsigned int clientunit;
+ gltextureunit_t units[MAX_TEXTUREUNITS];
+ float color4f[4];
+ int lockrange_first;
+ int lockrange_count;
+ int vertexbufferobject;
+ int elementbufferobject;
+ qboolean pointer_color_enabled;
+ const void *pointer_vertex;
+ const void *pointer_color;
+ size_t pointer_vertex_offset;
+ size_t pointer_color_offset;
+ int pointer_vertex_buffer;
+ int pointer_color_buffer;
+}
+gl_state_t;
+
+static gl_state_t gl_state;
+
+static memexpandablearray_t gl_bufferobjectinfoarray;
+