Hello Guest

XMLLoader

  • 3 Replies
  • 12599 Views
*

Offline CaseyB

  • ***
  • 118
XMLLoader
« on: July 19, 2005, 20:18:24 »
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!

*

Offline CaseyB

  • ***
  • 118
Hmmm
« Reply #1 on: July 20, 2005, 14:40:45 »
Ok, here is what i am trying:
Code: [Select]
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:
Code: [Select]
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]

*

Offline Matzon

  • *****
  • 2242
XMLLoader
« Reply #2 on: July 20, 2005, 15:13:38 »
/me patiently waits for Cas to explain the code :roll:

*

Offline CaseyB

  • ***
  • 118
FrameProcessor
« Reply #3 on: July 20, 2005, 15:13:57 »
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!