瀏覽代碼

Add flag enabling vertex shader control over point size

rdb 10 年之前
父節點
當前提交
aca077916d

+ 17 - 0
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -374,6 +374,10 @@ CLP(GraphicsStateGuardian)(GraphicsEngine *engine, GraphicsPipe *pipe) :
 
   _white_texture = 0;
 
+#ifndef OPENGLES
+  _shader_point_size = false;
+#endif
+
 #ifdef HAVE_CG
   _cg_context = 0;
 #endif
@@ -6016,6 +6020,19 @@ do_issue_shader() {
     }
   }
 
+#ifndef OPENGLES
+  // Is the point size provided by the shader or by OpenGL?
+  bool shader_point_size = _target_shader->get_flag(ShaderAttrib::F_shader_point_size);
+  if (shader_point_size != _shader_point_size) {
+    if (shader_point_size) {
+      glEnable(GL_PROGRAM_POINT_SIZE);
+    } else {
+      glDisable(GL_PROGRAM_POINT_SIZE);
+    }
+    _shader_point_size = shader_point_size;
+  }
+#endif
+
   report_my_gl_errors();
 }
 #endif  // !OPENGLES_1

+ 4 - 0
panda/src/glstuff/glGraphicsStateGuardian_src.h

@@ -608,6 +608,10 @@ protected:
   ShaderContext *_texture_binding_shader_context;
 
   static PT(Shader) _default_shader;
+
+#ifndef OPENGLES
+  bool _shader_point_size;
+#endif
 #endif
 
 #ifdef HAVE_CG

+ 1 - 0
panda/src/pgraph/shaderAttrib.h

@@ -49,6 +49,7 @@ PUBLISHED:
     F_disable_alpha_write = 0,  // Suppress writes to color buffer alpha channel.
     F_subsume_alpha_test  = 1,  // Shader promises to subsume the alpha test using TEXKILL
     F_hardware_skinning   = 2,  // Shader needs pre-animated vertices
+    F_shader_point_size   = 3,  // Shader provides point size, not RenderModeAttrib
   };
 
   INLINE bool               has_shader() const;