Hello, ok so I am very new to jME and i am having great difficulty texturing my 3D objects…
Here is a class I'm working on in which I am using a gun object that I pre-converted to .jme format
package jmetest.Newbie;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Logger;
import com.jme.app.SimpleGame;
import com.jme.image.Texture;
import com.jme.scene.Spatial;
import com.jme.scene.state.TextureState;
import com.jme.util.TextureManager;
import com.jme.util.export.binary.BinaryImporter;
public class Modeling extends SimpleGame {
public static void main(String[] args) {
Modeling app = new Modeling();
app.start();
}
private static final Logger logger = Logger.getLogger(Modeling.class
.getName());
protected void simpleInitGame() {
TextureState ts = display.getRenderer().createTextureState();
ts.setEnabled(true);
Texture t = TextureManager.loadTexture("/jmetest/Newbie/WW2 German Guns/mg34t.jpg", Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR );
t.setWrap(Texture.WM_WRAP_S_WRAP_T);
ts.setTexture(t);
Spatial model = null;
try {
URL locale = Modeling.class.getClassLoader().getResource("jmetest/Newbie/WW2 German Guns/gun-mg34-3ds.jme");
BinaryImporter importer = new BinaryImporter();
model = (Spatial)importer.load(locale.openStream());
model.updateRenderState();
} catch (IOException e) {
logger
.throwing(this.getClass().toString(), "wow you fucked up!!",
e);
}
rootNode.setRenderState(ts);
rootNode.attachChild(model);
}
}
This renders the gun just fine but there is no texture on it. There are no error messages or anything so it seems to be loading the image correctly. I can't even apply a simple one color MaterialState. I'm really confused here..