Browse Source

A few glgsg fixes from tobspr

rdb 9 years ago
parent
commit
711c97ad6d

+ 8 - 5
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -169,7 +169,7 @@ static const string default_fshader =
   "#version 130\n"
   "in vec2 texcoord;\n"
   "in vec4 color;\n"
-  "out vec4 p3d_FragColor;"
+  "out vec4 p3d_FragColor;\n"
   "uniform sampler2D p3d_Texture0;\n"
   "uniform vec4 p3d_TexAlphaOnly;\n"
 #else
@@ -2518,7 +2518,7 @@ reset() {
 
   if (core_profile) {
     // TODO: better detection mechanism?
-    _supports_stencil = true;
+    _supports_stencil = support_stencil;
   }
 #ifdef SUPPORT_FIXED_FUNCTION
   else if (support_stencil) {
@@ -2989,7 +2989,7 @@ clear(DrawableRegion *clearable) {
     mask |= GL_DEPTH_BUFFER_BIT;
   }
 
-  if (clearable->get_clear_stencil_active()) {
+  if (_supports_stencil && clearable->get_clear_stencil_active()) {
     glStencilMask(~0);
     glClearStencil(clearable->get_clear_stencil());
     mask |= GL_STENCIL_BUFFER_BIT;
@@ -4817,6 +4817,7 @@ update_texture(TextureContext *tc, bool force) {
     if (gtc->was_properties_modified()) {
       specify_texture(gtc, tex->get_default_sampler());
     }
+
     bool okflag = upload_texture(gtc, force, tex->uses_mipmaps());
     if (!okflag) {
       GLCAT.error()
@@ -6238,7 +6239,9 @@ do_issue_render_mode() {
   }
   report_my_gl_errors();
 
+#ifdef SUPPORT_FIXED_FUNCTION
   do_point_size();
+#endif
 }
 
 /**
@@ -12703,9 +12706,9 @@ extract_texture_image(PTA_uchar &image, size_t &page_size,
  * Internally sets the point size parameters after any of the properties have
  * changed that might affect this.
  */
+#ifdef SUPPORT_FIXED_FUNCTION
 void CLP(GraphicsStateGuardian)::
 do_point_size() {
-#ifndef OPENGLES_2
   if (!_point_perspective) {
     // Normal, constant-sized points.  Here _point_size is a width in pixels.
     static LVecBase3f constant(1.0f, 0.0f, 0.0f);
@@ -12735,8 +12738,8 @@ do_point_size() {
   }
 
   report_my_gl_errors();
-#endif
 }
+#endif
 
 /**
  * Returns true if this particular GSG supports the specified Cg Shader

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

@@ -567,7 +567,9 @@ protected:
            Texture::ComponentType type,
            Texture::CompressionMode compression, int n);
 
+#ifdef SUPPORT_FIXED_FUNCTION
   void do_point_size();
+#endif
 
   enum AutoAntialiasMode {
     AA_poly,