HELP! MutiTexturing in JME using GLSL

When using MutiTexturing with GLSL,only the first texture can be accessed. The others cannot be visited. Why?

here is the code

import com.jme.bounding.BoundingSphere;
import com.jme.image.Texture;
import com.jme.input.FirstPersonHandler;
import com.jme.input.InputHandler;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.light.PointLight;
import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.Spatial;
import com.jme.scene.shape.Sphere;
import com.jme.scene.state.GLSLShaderObjectsState;
import com.jme.scene.state.LightState;
import com.jme.scene.state.TextureState;
import com.jme.scene.state.ZBufferState;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.util.TextureManager;
import com.jme.util.Timer;

public class TextureMapping extends BaseGame
   private Node rootNode;
   protected Timer timer;
   private Camera cam;
   protected InputHandler input;
   private int width, height, depth, freq;
   private boolean fullscreen;
   private Sphere sphere = new Sphere("sphere1",150,150,10);
   private float angle = 0;
   Quaternion quad=new Quaternion();
   Quaternion rotQuat=new Quaternion();
   protected void update(float interpolation)
      // TODO Auto-generated method stub
      interpolation = timer.getTimePerFrame();   
      // if escape was pressed, we exit
      if (KeyBindingManager.getKeyBindingManager().isValidCommand("exit"))
         finished = true;
      if (interpolation < 1)
         angle = angle + (interpolation * 0.5f);
         if (angle > 360)
            angle = 0;
      quad.fromAngleAxis(-FastMath.PI/2,new Vector3f(1,0,0));      
      rotQuat.fromAngleAxis(angle, new Vector3f(0, 1, 0));      

   protected void render(float interpolation)
      // TODO Auto-generated method stub

   protected void initSystem()
      // TODO Auto-generated method stub
      width = properties.getWidth();
      height = properties.getHeight();
      depth = properties.getDepth();
      freq = properties.getFreq();
      fullscreen = properties.getFullscreen();
         display = DisplaySystem.getDisplaySystem(properties.getRenderer());
         display.createWindow(width, height, depth, freq, fullscreen);

         cam = display.getRenderer().createCamera(width, height);
      catch (JmeException e)

      //set the background to black
      //initialize the camera
      cam.setFrustumPerspective(45.0f, (float)width / (float)height, 1, 1000);
      Vector3f loc = new Vector3f(0.0f, 0.0f, 35.0f);
      Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);
      Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
      Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);
      // Move our camera to a correct place and orientation.
      cam.setFrame(loc, left, up, dir);
      /** Signal that we've changed our camera's location/frustum. */
      /** Create a input controller. */

you have to set the texture unit number for the samplers. like setUniform( "Monkey", 0 ), setUniform( "Dirt", 1 ) etc

look at the bloomrenderpass source on how it's doneā€¦

thanks very works well when i add

   so.setUniform("Monkey", 0);



and another question. if i have a "uniform sampler3D Noise" in fragment shader. How to setup it in the application. Did JME support 3DTexture?

and how to setup samples like sampler2DShadow,sampler2DShadow and samplerCube??  :smiley:

jDonkey said:

thanks very works well when i add