From 1efa85c8c060de3d7ff504521a9f65ad75ec257c Mon Sep 17 00:00:00 2001 From: Chien Yang Date: Wed, 16 Nov 2005 19:30:45 +0000 Subject: Fixed a bug in Shader support for immediate mode rendering. git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@463 ba19aa83-45c5-6ac9-afd3-db810772062c --- .../share/javax/media/j3d/GraphicsContext3D.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/classes/share/javax/media/j3d/GraphicsContext3D.java b/src/classes/share/javax/media/j3d/GraphicsContext3D.java index 34fbd8c..18e2ba8 100644 --- a/src/classes/share/javax/media/j3d/GraphicsContext3D.java +++ b/src/classes/share/javax/media/j3d/GraphicsContext3D.java @@ -2543,22 +2543,24 @@ public class GraphicsContext3D extends Object { ShaderProgramRetained spR = ((ShaderAppearanceRetained)app).shaderProgram; if ( spR != null) { spR.updateNative(canvas3d, true); - - ShaderAttributeSetRetained sasR = - ((ShaderAppearanceRetained)app).shaderAttributeSet; + + ShaderAttributeSetRetained sasR = + ((ShaderAppearanceRetained)app).shaderAttributeSet; if (sasR != null) { sasR.updateNative(canvas3d, spR); } + canvas3d.shaderProgram = spR; useShaders = true; } - else { - canvas3d.shaderProgram.updateNative(canvas3d, false); - useShaders = false; - } } - + else if (canvas3d.shaderProgram != null) { + canvas3d.shaderProgram.updateNative(canvas3d, false); + canvas3d.shaderProgram = null; + useShaders = false; + } + // Set the number of available texture units; this depends on // whether or not shaders are being used. int availableTextureUnits = -- cgit v1.2.3