/**
Tracks OpenGL state based on the command stream. This class is essentially a
(partial) OpenGL implementation in itself.
-
-XXX Should determine the number of texture units the target implementation
-actually supports.
*/
class GlState
{
private:
GlDecoder *decoder;
Vector4 color;
- Vector4 texcoord[8];
+ std::vector<Vector4> texcoord;
Vector3 normal;
unsigned active_tex;
unsigned client_active_tex;
TextureMap textures;
- TexUnitState texunits[8];
+ std::vector<TexUnitState> texunits;
BufferMap buffers;
BufferState *array_buffer;
BufferState *element_buffer;
ArrayState vertex_array;
ArrayState normal_array;
ArrayState color_array;
- ArrayState texcoord_arrays[8];
- std::map<unsigned, ArrayState> attrib_arrays;
+ std::vector<ArrayState> texcoord_arrays;
+ std::vector<ArrayState> attrib_arrays;
ShaderMap shaders;
ProgramMap programs;
int decode(const char *, unsigned);
+private:
+ static void glGetIntegerv(void *, GLenum, int *);
+
+public:
+ unsigned get_max_texture_units() const { return texunits.size(); }
+ unsigned get_max_vertex_attribs() const { return attrib_arrays.size(); }
+ unsigned get_max_uniform_buffer_bindings() const { return uniform_bind_points.size(); }
+
private:
bool &get_boolean_state(GLenum);
static void glEnableClientState(void *, GLenum);
const Vector3 &get_normal() const { return normal; }
private:
- ArrayState &get_attrib_array(unsigned);
-
static void glVertexPointer(void *, int, GLenum, int, const void *);
static void glNormalPointer(void *, GLenum, int, const void *);
static void glColorPointer(void *, int, GLenum, int, const void *);