 |
Irrlicht Engine Official forum of the Irrlicht Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Serg Nechaeff
Joined: 26 Nov 2003 Posts: 163 Location: Europe
|
Posted: Wed Jun 28, 2006 7:22 pm Post subject: Setting Up Eclipse IDE and JIRR on Windows |
|
|
Setting Up Eclipse IDE and JIRR on Windows
This is a short tutorial on how to start programming amazing 3d graphics in Java language using Irrlicht IDE. First of all, you have to:
Download necessary packages
Eclipse IDE (http://www.eclipse.org/downloads/) about ~100Mbs.
Jirr (https://sourceforge.net/projects/jirr/) about ~10Mbs.
Download jirr_bin and jirr packages. jirr_3rd_party is used to combine Swing and Irrlicht and you may need it later.
Setup Eclipse IDE
All you have to do is to unzip the archive you have downloaded to any folder. Unzip jirr_bin to any folder. Start Eclipse IDE Go to the folder you have unzipped the Eclipse package to and click 'eclipse.exe' file. If you experience any problems starting Eclipse, check out the eclipse web-site, read FAQs, ask people etc. Eclipse is very very popular and you will not spend much time looking for an answer.
Create the project
Create the folder anywhere you like, name it for example: JirrTest Make a few subfolders:
src
classes
media
lib
Copy:
all DLL files from JIRR distribution package's bin folder to JirrTest root folder;
all files from JIRR distribution package's lib folder to JirrTest/lib folder;
all files from JIRR's media folder to JirrTest/media folder;
Now your new JirrTest folder should look like the one on the picture:
Setup the project in Eclipse IDE
In Eclipse go to File->New->Project->Java Project
Click Next
Click OK and the Finish
Create Demo class
Go to File->New->Class:
Copy and paste the following code (comes with the sources of Jirr in the examples folder):
| Code: |
package com.leadercode;
import net.sf.jirr.*;
public class Demo {
static {
System.loadLibrary("irrlicht_wrap");
}
public static void main(String argv[]) {
IrrlichtDevice device = Jirr.createDeviceJava(E_DRIVER_TYPE.EDT_OPENGL,
640, 480, 16, false, false, false, null);
System.out.println("idevice = " + device);
String windowCaption = "Java@Hello World! - Irrlicht Engine Demo";
device.setWindowCaption(windowCaption);
IVideoDriver driver = device.getVideoDriver();
ISceneManager smgr = device.getSceneManager();
IGUIEnvironment guienv = device.getGUIEnvironment();
String text = "Hello World! This is the Irrlicht Software engine for Java!";
recti rect = new recti(10, 10, 280, 30);
IGUIStaticText staticText = guienv.addStaticText(text, rect, true,
true, null, -1);
IAnimatedMesh mesh = smgr.getMesh("media/sydney.md2");
IAnimatedMeshSceneNode node = smgr.addAnimatedMeshSceneNode(mesh, null,
-1, new vector3df(0, 0, 0), new vector3df(0, 0, 0),
new vector3df(1, 1, 1));
if (node != null) {
node.setMaterialFlag(E_MATERIAL_FLAG.EMF_LIGHTING, false);
node.setFrameLoop(0, 99999);
node
.setMaterialTexture(0, driver
.getTexture("media/sydney.bmp"));
}
smgr.addCameraSceneNode(null, new vector3df(0, 10, -60), new vector3df(
0, 0, 0), -1);
final int step = 100;
int counter = 0;
double diff = 0;
long timer1 = System.currentTimeMillis();
long timer2 = 0;
while (device.run()) {
int a = 0;
int r = 100;
int g = 100;
int b = 100;
driver.beginScene(true, true, new SColor(a, r, g, b));
smgr.drawAll();
guienv.drawAll();
driver.endScene();
try {
// Thread.sleep(5);
} catch (Exception e) {
}
counter++;
if (counter >= step) {
timer2 = System.currentTimeMillis();
diff = 1000.0 / ((timer2 - timer1) / (double) step);
counter = 0;
timer1 = System.currentTimeMillis();
text = "This is the Irrlicht Software engine for Java! FPS: "
+ diff;
staticText.setText(text);
}
}
device.closeDevice();
}
}
|
Go to Run->Run As->Java Application
Voila! Irrlicht is up and running! That's all folks.[/code] _________________ http://www.javazing.com
P-III-950, WinXP, GeForce FX5600 128 MB ForceWare 52.16, DX9, Eclipse IDE, JRE 1.6
Last edited by Serg Nechaeff on Wed Apr 18, 2007 6:30 pm; edited 1 time in total |
|
| Back to top |
|
 |
Stratus
Joined: 19 Mar 2007 Posts: 1
|
Posted: Mon Mar 19, 2007 4:10 am Post subject: Good Post |
|
|
Verry good Post, this little tutorial helps me to start writing Irrllicht With Java and Eclipse.
Please correct te URL's of the pictures in order that we can see them _________________ Con Precisión de Ingeniero y Pasión de Montañista
---
http://www.imatec.cl |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|