#include "arraystate.h"
#include "bufferstate.h"
+#include "enums.h"
+#include "strformat.h"
+
+using namespace std;
ArrayState::ArrayState():
kind(0),
if(buffer)
buffer->content.update(*this);
}
+
+string ArrayState::describe() const
+{
+ if(enabled)
+ {
+ string descr = strformat("%d %s, stride %d", size, describe_enum(type, "DataType"), stride);
+ if(buffer)
+ descr += strformat(", buffer %d at %d", buffer->id, pointer);
+ else
+ descr += strformat(", at 0x%X", pointer);
+ return descr;
+ }
+ else
+ return "Disabled";
+}
.set_help("Inspects general GL state",
"state vertex\n"
" Print current vertex attributes\n\n"
+ "state array\n"
+ " Show current vertex arrays\n\n"
"state bind\n"
" Show current bindings\n");
const Vector3 &normal = glstate.get_normal();
printf(" Normal: [%05.3f, %05.3f, %05.3f]\n", normal.x, normal.y, normal.z);
}
+ else if(args=="array")
+ {
+ printf("Current vertex arrays:\n");
+ string descr = glstate.get_array(GL_VERTEX_ARRAY).describe();
+ printf(" Vertex: %s\n", descr.c_str());
+ descr = glstate.get_array(GL_NORMAL_ARRAY).describe();
+ printf(" Normal: %s\n", descr.c_str());
+ descr = glstate.get_array(GL_COLOR_ARRAY).describe();
+ printf(" Color: %s\n", descr.c_str());
+ unsigned count = glstate.get_max_texture_units();
+ for(unsigned i=0; i<count; ++i)
+ {
+ descr = glstate.get_texture_coord_array(i).describe();
+ printf(" TexCoord%d: %s\n", i, descr.c_str());
+ }
+ count = glstate.get_max_vertex_attribs();
+ for(unsigned i=0; i<count; ++i)
+ {
+ descr = glstate.get_attrib_array(i).describe();
+ printf(" Attrib%d:%s %s\n", i, (i>=10 ? " " : " "), descr.c_str());
+ }
+ }
else if(args=="bind")
{
printf("Current bindings:\n");