]> git.tdb.fi Git - gldbg.git/blobdiff - flavors/gl/source/inspector.cpp
Add a command to show current vertex array state
[gldbg.git] / flavors / gl / source / inspector.cpp
index 122c2e45298f340ddfe935a2f5e29375dcde480c..de8031b2f22931d429c27ac1dbd45fd922050352 100644 (file)
@@ -21,6 +21,8 @@ Inspector::Inspector(GlDbg &d):
                .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");
 
@@ -118,6 +120,28 @@ void Inspector::cmd_state(const string &args)
                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");