فهرست منبع

BUG FOUND in shader_program_uniforms_map, finding indices NOT locations of uniform variables, checking in corrections to code and comments before deleting

Former-commit-id: 3c6f12fb9e35afd27dd65e08dec033da8ed3e86f
jalec 13 سال پیش
والد
کامیت
0de0916db7
1فایلهای تغییر یافته به همراه8 افزوده شده و 2 حذف شده
  1. 8 2
      shader_program_uniforms_map.h

+ 8 - 2
shader_program_uniforms_map.h

@@ -12,11 +12,11 @@
 namespace igl
 {
   // Builds a map of *active* uniform names as strings to their respective
-  // locations as GLuint.
+  // indices (NOT locations) as GLuint.
   // Input:
   //   id  index id of the program to query 
   // Output:
-  //   uniforms  map of names to locations
+  //   uniforms  map of names to indices
   // Returns true on success, false on errors
   void shader_program_uniforms_map(
     const GLuint id, 
@@ -26,6 +26,7 @@ namespace igl
 // Implementation
 #include "verbose.h"
 #include "report_gl_error.h"
+#include "uniform_type_to_string.h"
 
 void igl::shader_program_uniforms_map(
   const GLuint id, 
@@ -58,6 +59,11 @@ void igl::shader_program_uniforms_map(
     glGetActiveUniform(id,u,max_name_length,&length,&size,&type,name);
     // insert into map
     uniforms[string(name)] = u;
+    verbose("%s --> index: %d size: %d type: %s\n",
+      name,
+      (int)u,
+      size,
+      uniform_type_to_string(type).c_str());
   }
 
   delete[] name;