From 44ded763ea870d0daad90a0f7355a5792b16b774 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sun, 18 Mar 2007 23:30:00 +0000 Subject: Added extensible action method mechanism via ActionTable, decoupling Action implementations from the set of Nodes in the library. Refactored OpenGL rendering into node instances to potentially share more code among different Action subclasses. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/joglutils/trunk@45 83d24430-9974-4f80-8418-2cc3294053b9 --- src/net/java/joglutils/msg/nodes/Texture2.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/net/java/joglutils/msg/nodes/Texture2.java') diff --git a/src/net/java/joglutils/msg/nodes/Texture2.java b/src/net/java/joglutils/msg/nodes/Texture2.java index 441c2f5..fd1b82a 100644 --- a/src/net/java/joglutils/msg/nodes/Texture2.java +++ b/src/net/java/joglutils/msg/nodes/Texture2.java @@ -45,6 +45,7 @@ import javax.media.opengl.*; import com.sun.opengl.util.texture.*; import net.java.joglutils.msg.actions.*; +import net.java.joglutils.msg.elements.*; /** Represents a two-dimensional texture. */ @@ -54,6 +55,11 @@ public class Texture2 extends Node { private int texEnvMode = MODULATE; private boolean dirty; + static { + // Enable the elements this node affects for known actions + GLTextureElement.enable(GLRenderAction.getDefaultState()); + } + /** Represents the OpenGL MODULATE texture environment mode. */ public static final int MODULATE = 1; /** Represents the OpenGL DECAL texture environment mode. */ @@ -134,6 +140,8 @@ public class Texture2 extends Node { } public void doAction(Action action) { - action.visit(this); + if (TextureElement.isEnabled(action.getState())) { + TextureElement.set(action.getState(), getTexture(), getTexEnvMode()); + } } } -- cgit v1.2.3