i am new to all this jme stuff and i am trying my way arround
I would like to know if someone has a sample code on how to load .jme file into java and opengl
thanks
There are 4 or 5 of them in the jmetest area of the code. Just start digging around the test area, that will solve the majority of your questions.
cheers will have a look
i have converted a .3ds file into .jme and i already had a look in the code and tryied to load the model but got stuck because i dont know my way arround scene graph i know the commands i need to use but does not seem to work here is what i have tryied
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.util.logging.Level;
import com.jme.app.SimpleGame;
import com.jme.scene.Node;
import com.jme.util.LoggingSystem;
import com.jmex.model.XMLparser.BinaryToXML;
import com.jmex.model.XMLparser.JmeBinaryReader;
import com.jmex.model.XMLparser.Converters.FormatConverter;
//import com.jmex.model.XMLparser.Converters.ObjToJme;
/**
- Started Date: Jul 22, 2004<br><br>
*
- Demonstrates loading formats.
*
-
@author Jack Lindamood
/
public class HelloModelLoadingjme extends SimpleGame {
public static void main(String[] args) {
app.setDialogBehaviour(SimpleGame.ALWAYS_SHOW_PROPS_DIALOG);
app.start();
/
protected void simpleInitGame() {
// Point to a URL of my model
URL model=HelloModelLoading.getResource("model/f15.jme");
*/
// This byte array will hold my .jme file
ByteArrayOutputStream holdsf15jme=new ByteArrayOutputStream();
// This will read the .jme format and convert it into a scene graph
JmeBinaryReader jbr=new JmeBinaryReader();
// Use this to visualize the .obj file in XML
BinaryToXML btx=new BinaryToXML();
// Send the .jme binary to System.out as XML
btx.sendBinarytoXML(new ByteArrayInputStream(holdsf15jme.toByteArray()),new OutputStreamWriter(System.out));
// Tell the binary reader to use bounding boxes instead of bounding spheres
jbr.setProperty("bound","box");
// Load the binary .jme format into a scene graph
Node f15=jbr.loadBinaryFormat(model/f15.jme) throws java.io.IOException;
rootNode.attachChild(holdsf15jme);
}
}
if u can direct me in the good way will be very nice
I am in the beginning but want to learn
alf3299 said:
rootNode.attachChild(holdsf15jme);
Yikes, what are you adding to the scenegraph there??
thanks
should it be
rootNode.attachChild(f15);
can someone help?
uh, did you try anything new or are you just looking for the code to be spoon fed? :’(
hi i have tried this but does not work
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.util.logging.Level;
import com.jme.app.SimpleGame;
import com.jme.scene.Node;
import com.jme.util.LoggingSystem;
import com.jmex.model.XMLparser.BinaryToXML;
import com.jmex.model.XMLparser.JmeBinaryReader;
import com.jmex.model.XMLparser.Converters.FormatConverter;
//import com.jmex.model.XMLparser.Converters.ObjToJme;
/**
- Started Date: Jul 22, 2004<br><br>
*
- Demonstrates loading formats.
*
-
@author Jack Lindamood
/
public class HelloModelLoadingjme extends SimpleGame {
public static void main(String[] args) {
app.setDialogBehaviour(SimpleGame.ALWAYS_SHOW_PROPS_DIALOG);
app.start();
/
protected void simpleInitGame() {
// Point to a URL of my model
URL model=HelloModelLoading.getResource("model/f15.jme");
*/
// This byte array will hold my .jme file
ByteArrayOutputStream holdsf15jme=new ByteArrayOutputStream();
// This will read the .jme format and convert it into a scene graph
JmeBinaryReader jbr=new JmeBinaryReader();
// Use this to visualize the .obj file in XML
BinaryToXML btx=new BinaryToXML();
// Send the .jme binary to System.out as XML
btx.sendBinarytoXML(new ByteArrayInputStream(holdsf15jme.toByteArray()),new OutputStreamWriter(System.out));
// Tell the binary reader to use bounding boxes instead of bounding spheres
jbr.setProperty("bound","box");
// Load the binary .jme format into a scene graph
Node f15=jbr.loadBinaryFormat(model/f15.jme);
rootNode.attachChild(f15);
}
}
thanks for your attention
just a comment why u say spoon feed ?
i think these forums exist to help people no ?!
so here in your forum u guys are spoom feeding everybody or trying to help people to understand and to use these libraries
is not spoon feed i twill help me devoloping what i am doing at the moment and yes i already tryied things but i dont know this librarie and in the getting started tutorial i could not understand everything.And i know that for someone that know the librarie might be be very simple to load a .jme file dont understand why this problem
anyway help is apreciated
thanks
:-o This code could not even compile (uncaught exception, not implemented method, missing .class, rubbish calls). Neither does it make sense to call anything after the start() call.
Sure these forums are for help - but you ask about model loading and it seems you don't even know how to write a general jme-application.
Please try out the nice new tutorial. Then get back and have a look at the model loading example again.
its true not many experience with jme i will try the nice new tutorial then
but is there any sample code to load .jme i am sure is prety easy
cheers i might have a different way to learn
Sure, when you have a look at HelloModelLoading again: everything related to 'converter' and 'btx' is not needed to load a jme-file. Then instead of doing
Node maggie=jbr.loadBinaryFormat(new ByteArrayInputStream(BO.toByteArray()));
do
Node maggie=jbr.loadBinaryFormat(model.openStream());
That's it.
cheers i will have a go
and after i tell u the results
btx is binnary to xml right i thought it was needed u see like i am starting to understand tks
i have not tested yet i am having lunch after i tell how it went
shouldn t this work i removed all converters and btx
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.util.logging.Level;
import com.jme.app.SimpleGame;
import com.jme.scene.Node;
import com.jme.util.LoggingSystem;
import com.jmex.model.XMLparser.BinaryToXML;
import com.jmex.model.XMLparser.JmeBinaryReader;
import com.jmex.model.XMLparser.Converters.FormatConverter;
//import com.jmex.model.XMLparser.Converters.ObjToJme;
/**
- Started Date: Jul 22, 2004<br><br>
*
- Demonstrates loading formats.
*
-
@author Jack Lindamood
*/
public class HelloModelLoadingjme extends SimpleGame {
what about learning Java and using an IDE first?
can u just say what i wrong with the code pleass or put same sample code i easier for me to learn jme
thanks
I would suggest downloading the source for jME and looking at the test code there. I'm sure you can understand we don't really want to have to explain jME in a thread for every new user. That's why we have the wiki and the Tests that are in the source code for people to look at. If you have questions on either of those feel free ask. We're here to help, but we try to keep the hand-holding to a minimum.
darkfrog
cheers didnt know about wiki will have a go