rootNode.setRenderState( ts );
terrain.setRenderState( ts );
	protected void simpleInitGame() {		try {			display.setTitle( "Projected Texture Test" );			cam.getLocation().set( new Vector3f( 50, 50, 0 ) );			cam.lookAt( new Vector3f(), Vector3f.UNIT_Y );			CullState cs = display.getRenderer().createCullState();			cs.setCullMode( CullState.CS_BACK );			cs.setEnabled( true );			//load projector model			MilkToJme converter2 = new MilkToJme();			URL MSFile2 = TestMilkJmeWrite.class.getClassLoader().getResource(					"jmetest/data/model/msascii/camera.ms3d" );			ByteArrayOutputStream BO2 = new ByteArrayOutputStream();			try {				converter2.convert( MSFile2.openStream(), BO2 );			} catch( IOException e ) {				System.out.println( "IO problem writting the file!!!" );				System.out.println( e.getMessage() );				System.exit( 0 );			}			URL TEXdir2 = TestMilkJmeWrite.class.getClassLoader().getResource(					"jmetest/data/model/msascii/" );			projectorModel = null;			try {				TextureKey.setOverridingLocation( TEXdir2 );				projectorModel = (Node) BinaryImporter.getInstance().load( new ByteArrayInputStream( BO2.toByteArray() ) );			} catch( IOException e ) {				System.out.println( "darn exceptions:" + e.getMessage() );			}			rootNode.attachChild( projectorModel );			//create terrain			URL grayScale = TestProjectedTexture.class.getClassLoader().getResource( "jmetest/data/texture/terrain.png" );			ImageBasedHeightMap heightMap = new ImageBasedHeightMap( new ImageIcon( grayScale ).getImage() );			Vector3f terrainScale = new Vector3f( 5, 0.25f, 5 );			terrain = new TerrainPage( "image icon", 33, (heightMap.getSize()) + 1, new Vector3f( .5f, .05f, .5f ), heightMap.getHeightMap(), false );			terrain.setDetailTexture( 1, 16 );			terrain.setModelBound( new BoundingBox() );			terrain.updateModelBound();			terrain.setLocalTranslation( new Vector3f( 0, 0, 0 ) );			rootNode.attachChild( terrain );			rootNode.setRenderState( cs );			ProceduralSplatTextureGenerator pst = new ProceduralSplatTextureGenerator( heightMap );			pst.addTexture( new ImageIcon( TestProjectedTexture.class.getClassLoader().getResource(					"jmetest/data/texture/grassb.png" ) ), -128, 0, 128 );			pst.addTexture( new ImageIcon( TestProjectedTexture.class.getClassLoader().getResource(					"jmetest/data/texture/dirt.jpg" ) ), 0, 128, 255 );			pst.addTexture( new ImageIcon( TestProjectedTexture.class.getClassLoader().getResource(					"jmetest/data/texture/highest.jpg" ) ), 128, 255, 384 );			pst.addSplatTexture( new ImageIcon( TestProjectedTexture.class.getClassLoader().getResource(					"jmetest/data/texture/terrainTex.png" ) ), new ImageIcon( TestProjectedTexture.class.getClassLoader().getResource(					"jmetest/data/texture/water.png" ) ) );			pst.createTexture( 512 );			TextureState ts = display.getRenderer().createTextureState();			ts.setEnabled( true );			Texture t1 = TextureManager.loadTexture( pst.getImageIcon().getImage(), Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR, true );			ts.setTexture( t1, 0 );			projectedTexture = TextureManager.loadTexture( TestProjectedTexture.class.getClassLoader().getResource(					"jmetest/data/images/Monkey.png" ), Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR );			ts.setTexture( projectedTexture, 1 );			//this is were we set the texture up for projection			projectedTexture.setMatrix( textureMatrix );			projectedTexture.setEnvironmentalMapMode( Texture.EM_EYE_LINEAR );			projectedTexture.setWrap( Texture.WM_BCLAMP_S_BCLAMP_T );			//make the projected texture blend with the terrain texture			t1.setApply( Texture.AM_COMBINE );			t1.setCombineFuncRGB( Texture.ACF_MODULATE );			t1.setCombineSrc0RGB( Texture.ACS_TEXTURE );			t1.setCombineOp0RGB( Texture.ACO_SRC_COLOR );			t1.setCombineSrc1RGB( Texture.ACS_PRIMARY_COLOR );			t1.setCombineOp1RGB( Texture.ACO_SRC_COLOR );			t1.setCombineScaleRGB( 1.0f );			projectedTexture.setApply( Texture.AM_COMBINE );			projectedTexture.setCombineFuncRGB( Texture.ACF_ADD );			projectedTexture.setCombineSrc0RGB( Texture.ACS_TEXTURE );			projectedTexture.setCombineOp0RGB( Texture.ACO_SRC_COLOR );			projectedTexture.setCombineSrc1RGB( Texture.ACS_PREVIOUS );			projectedTexture.setCombineOp1RGB( Texture.ACO_SRC_COLOR );			projectedTexture.setCombineScaleRGB( 1.0f );			rootNode.setRenderState( ts );			rootNode.setRenderQueueMode( com.jme.renderer.Renderer.QUEUE_OPAQUE );			fpsNode.setRenderQueueMode( com.jme.renderer.Renderer.QUEUE_OPAQUE );		} catch( Exception e ) {			e.printStackTrace();		}	}