Browse Source

cleanup initialization

David Rose 23 years ago
parent
commit
774b6018d5

+ 0 - 25
panda/src/glgsg/glGraphicsStateGuardian.I

@@ -706,31 +706,6 @@ enable_point_smooth(bool val) {
   }
 }
 
-////////////////////////////////////////////////////////////////////
-//     Function: GLGraphicsStateGuardian::enable_dither
-//       Access:
-//  Description:
-////////////////////////////////////////////////////////////////////
-INLINE void GLGraphicsStateGuardian::
-enable_dither(bool val) {
-  if (_dither_enabled != val) {
-    _dither_enabled = val;
-    if (val) {
-#ifdef GSG_VERBOSE
-      glgsg_cat.debug()
-        << "glEnable(GL_DITHER)" << endl;
-#endif
-      glEnable(GL_DITHER);
-    } else {
-#ifdef GSG_VERBOSE
-      glgsg_cat.debug()
-        << "glDisable(GL_DITHER)" << endl;
-#endif
-      glDisable(GL_DITHER);
-    }
-  }
-}
-
 ////////////////////////////////////////////////////////////////////
 //     Function: GLGraphicsStateGuardian::enable_stencil_test
 //       Access:

+ 18 - 11
panda/src/glgsg/glGraphicsStateGuardian.cxx

@@ -206,10 +206,24 @@ reset() {
   _shade_model_mode = GL_SMOOTH;
   glFrontFace(GL_CCW);
 
+  _scissor_x = 0;
+  _scissor_y = 0;
+  _scissor_width = -1;
+  _scissor_height = -1;
+  _viewport_x = 0;
+  _viewport_y = 0;
+  _viewport_width = -1;
+  _viewport_height = -1;
+  _lmodel_local = 0;
+  _lmodel_twoside = 0;
   _line_width = 1.0f;
   _point_size = 1.0f;
+  _blend_source_func = GL_ONE;
+  _blend_dest_func = GL_ZERO;
   _depth_mask = false;
   _fog_mode = GL_EXP;
+  _fog_density = 1.0f;
+  _fog_color.set(0.0f, 0.0f, 0.0f, 0.0f);
   _alpha_func = GL_ALWAYS;
   _alpha_func_ref = 0;
   _polygon_mode = GL_FILL;
@@ -223,8 +237,8 @@ reset() {
   _line_smooth_enabled = false;
   _point_smooth_enabled = false;
   _scissor_enabled = false;
-  _normals_enabled = false;
   _texturing_enabled = false;
+  _stencil_test_enabled = false;
   _multisample_alpha_one_enabled = false;
   _multisample_alpha_mask_enabled = false;
   _blend_enabled = false;
@@ -234,14 +248,9 @@ reset() {
   _polygon_offset_enabled = false;
   _decal_level = 0;
 
-  // Dither is on by default in GL, let's turn it off
-  _dither_enabled = true;
-  enable_dither(false);
-
-  // Stencil test is off by default
-  _stencil_test_enabled = false;
-  _stencil_func = GL_NOTEQUAL;
-  _stencil_op = GL_REPLACE;
+  // Dither is on by default in GL; let's turn it off
+  glDisable(GL_DITHER);
+  _dithering_enabled = false;
 
   // Antialiasing.
   enable_line_smooth(false);
@@ -289,8 +298,6 @@ reset() {
   // use per-vertex fog if per-pixel fog requires SW renderer
   glHint(GL_FOG_HINT,GL_DONT_CARE);
 
-  _dithering_enabled = false;
-
   GLint iRedBits;
   glGetIntegerv(GL_RED_BITS,&iRedBits);
   if(iRedBits<24) {

+ 2 - 10
panda/src/glgsg/glGraphicsStateGuardian.h

@@ -210,7 +210,6 @@ protected:
   INLINE void enable_point_smooth(bool val);
   INLINE void enable_texturing(bool val);
   INLINE void enable_scissor(bool val);
-  INLINE void enable_dither(bool val);
   INLINE void enable_stencil_test(bool val);
   INLINE void enable_multisample_alpha_one(bool val);
   INLINE void enable_multisample_alpha_mask(bool val);
@@ -274,13 +273,6 @@ protected:
   GLsizei _viewport_height;
   GLboolean _lmodel_local;
   GLboolean _lmodel_twoside;
-  Colorf _material_ambient;
-  Colorf _material_diffuse;
-  Colorf _material_specular;
-  float _material_shininess;
-  Colorf _material_emission;
-  GLenum _stencil_func;
-  GLenum _stencil_op;
   GLfloat _line_width;
   GLfloat _point_size;
   GLenum _blend_source_func;
@@ -303,18 +295,18 @@ protected:
   bool _point_smooth_enabled;
   bool _scissor_enabled;
   bool _texturing_enabled;
-  bool _dither_enabled;
   bool _stencil_test_enabled;
   bool _multisample_alpha_one_enabled;
   bool _multisample_alpha_mask_enabled;
   bool _blend_enabled;
   bool _depth_test_enabled;
   bool _fog_enabled;
-  bool _dithering_enabled;
   bool _alpha_test_enabled;
   bool _polygon_offset_enabled;
   int _decal_level;
 
+  bool _dithering_enabled;
+
   int _max_lights;
   int _max_clip_planes;