LWJGL
May 17, 2012, 02:26:29 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: XMLLoader  (Read 3790 times)
CaseyB
Talks Too Much
***
Posts: 118



« on: July 19, 2005, 13: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!
Logged
CaseyB
Talks Too Much
***
Posts: 118



« Reply #1 on: July 20, 2005, 07:40:45 »

Ok, here is what i am trying:
Code:
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:
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]
Logged
Matzon
Administrator
Demigod
*****
Posts: 2177



« Reply #2 on: July 20, 2005, 08:13:38 »

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

http://certusgames.com (Free Online Multiplayer Java Games)
http://lwjgl.org (OpenGL/OpenAL for Java)
CaseyB
Talks Too Much
***
Posts: 118



« Reply #3 on: July 20, 2005, 08: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!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!