From 71dcf4bc553f8db1082fe25f5f1dee6e9e3e8e39 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 1 Jul 2009 12:32:04 +0000 Subject: [PATCH] Fix crash with OpenGL ES 1.x --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 12246efa1e..5a0753626c 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -6681,6 +6681,7 @@ set_state_and_transform(const RenderState *target, _target_rs = target; _target_shader = DCAST(ShaderAttrib, _target_rs->get_attrib_def(ShaderAttrib::get_class_slot())); +#ifndef OPENGLES_1 if (_target_shader->auto_shader()) { // If we don't have a generated shader, make sure we have a ShaderGenerator, then generate the shader. if (_target_rs->_generated_shader == NULL) { @@ -6691,6 +6692,7 @@ set_state_and_transform(const RenderState *target, } _target_shader = DCAST(ShaderAttrib, _target_rs->_generated_shader); } +#endif int alpha_test_slot = AlphaTestAttrib::get_class_slot(); if (_target_rs->get_attrib(alpha_test_slot) != _state_rs->get_attrib(alpha_test_slot) || @@ -6811,14 +6813,14 @@ set_state_and_transform(const RenderState *target, _state_mask.set_bit(color_blend_slot); } -#ifndef OPENGLES_1 if (_target_shader != _state_shader) { //PStatTimer timer(_draw_set_state_shader_pcollector); +#ifndef OPENGLES_1 do_issue_shader(); +#endif _state_shader = _target_shader; _state_mask.clear_bit(TextureAttrib::get_class_slot()); } -#endif int texture_slot = TextureAttrib::get_class_slot(); if (_target_rs->get_attrib(texture_slot) != _state_rs->get_attrib(texture_slot) ||