From 91e54d09f312fa727ad248b2158f0df4d00647a2 Mon Sep 17 00:00:00 2001 From: Shalin Shodhan Date: Wed, 4 Aug 2004 17:17:50 +0000 Subject: [PATCH] CgShader added compile protection --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 9 ++++++--- panda/src/glstuff/glGraphicsStateGuardian_src.h | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 5e8574ba77..d406417d87 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -39,7 +39,9 @@ #include "colorWriteAttrib.h" #include "texMatrixAttrib.h" #include "texGenAttrib.h" +#ifdef HAVE_CGGL #include "cgShaderAttrib.h" +#endif #include "materialAttrib.h" #include "renderModeAttrib.h" #include "fogAttrib.h" @@ -2345,9 +2347,10 @@ issue_tex_matrix(const TexMatrixAttrib *attrib) { // Also maintain the map of CgShader objects to // respective GLCgShaderContexts //////////////////////////////////////////////////////////////////// +#ifdef HAVE_CGGL void CLP(GraphicsStateGuardian):: issue_cg_shader_bind(const CgShaderAttrib *attrib) { -#ifdef HAVE_CGGL + if (attrib->is_off()) { //Current node has no shaders if (_cg_shader != (CgShader *) NULL) { _gl_cg_shader_contexts[_cg_shader]->un_bind();// Prev node had shaders @@ -2371,10 +2374,10 @@ issue_cg_shader_bind(const CgShaderAttrib *attrib) { csc->bind(this);// Bind the new shader } } -#endif + } - +#endif //////////////////////////////////////////////////////////////////// // Function: CLP(GraphicsStateGuardian)::issue_tex_gen // Access: Public, Virtual diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index 61742b663c..96afb252f9 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -35,7 +35,9 @@ #include "graphicsWindow.h" #include "pset.h" #include "pmap.h" +#ifdef HAVE_CGGL #include "cgShader.h" +#endif class PlaneNode; class Light; @@ -109,7 +111,9 @@ public: virtual void issue_fog(const FogAttrib *attrib); virtual void issue_depth_offset(const DepthOffsetAttrib *attrib); virtual void issue_tex_gen(const TexGenAttrib *attrib); +#ifdef HAVE_CGGL virtual void issue_cg_shader_bind(const CgShaderAttrib *attrib); +#endif // virtual void issue_stencil(const StencilAttrib *attrib); virtual void bind_light(PointLight *light_obj, const NodePath &light,