XMLLoader

Started by CaseyB, July 19, 2005, 20:18:24

Previous topic - Next topic

CaseyB

Is there a tutorial out there that shows how to use the XMLLoader?  I have been trying to figure it out, but really I'm just making stabs in the dark!  Any help would be greatly appreciated!

CaseyB

Ok, here is what i am trying:
try
{
   // Load in the XML File
   File XMLFile = new File("MeshedModelSample.xml");

   // Convert the XML into a Document
   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
   DocumentBuilder builder = factory.newDocumentBuilder();
   Document doc = builder.parse(XMLFile);

   // Load the Document into the XMLLoader
   XMLLoader loader = new XMLLoader(doc);
   // Get Model from XMLLoader
   model = (MeshedModel) loader.load();
   // Set the model into the ModelRenderer
   renderer.setModel(model);
}
catch (ParserConfigurationException e)
{
   System.err.println("Parser Error: " + e);
   e.printStackTrace();
}
catch (SAXException e)
{
   System.err.println("SAX Error: " + e);
   e.printStackTrace();
}
catch (IOException e)
{
   System.err.println("IO Error: " + e);
   e.printStackTrace();
}
catch (Exception e)
{
   System.err.println("Loader Error: " + e);
   e.printStackTrace();
}

I think this is loading the model correctly (well, at least it isn't throwing an exception) but then How do I draw it?  Here is my render method:
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GL11.glTranslatef(0.0f,0.0f,-7.0f);
renderer.render();

It doesn't show anything!  What am I doing wrong?[/code]

Matzon

/me patiently waits for Cas to explain the code :roll:

CaseyB

Looking throught the JavaDocs, it looks like I need a FrameProcessor, but it's not a concrete class and I can't seem to find anything that returns a FrameProcessor... I'll keep looking!

-=EDIT=-
I added some comments to the code above to better explain what I am trying to do!