Vertex attributes in GLSL

Ugh, spent a couple hours staring at this only to discover I was looking in the wrong place. Turns out there’s two interacting issues:

  1. As we discussed a while back (here: [url]GLSL shader problem]), the use of the “gl_” prefix is problematic. In your shader I changed gl_Vertex to p3d_Vertex, and prepended the necessary “attribute vec4 p3d_Vertex;” declaration.

  2. The function uses_custom_vertex_arrays() is broken…again. Here’s a patch for a one-line fix:

--- panda/src/glstuff/glShaderContext_src.I 2012-11-13 07:28:35.000000000 -0800
+++ panda/src/glstuff/glShaderContext_src.I 2012-11-13 07:28:35.000000000 -0800
@@ -46,7 +46,7 @@
   #ifdef OPENGLES_2
     return true;
   #else
-    return (_shader->get_language() == Shader::SL_Cg);
+    return (_shader->get_language() != Shader::SL_none);
   #endif
 }

With those two modifications the extra vertex data was available as expected in the shader.

Hope that helps, let me know if you’re still having problems. I continue to be amazed that you’re planning on shipping a game with GLSL shaders, given the, uh, “functionally impaired” nature of the current implementation…

–jonah