Installation
From ogre4j
Contents |
Building
Java
An ant build.xml file is provided in the src package. To build only the Java part use the target ogre4j.build.jar.
C++
Windows
We provide a Visual Studio 2005 project in org.ogre4j/src/c/scripts. It requires the environment variables JAVA_HOME and OGRE_HOME. OGRE_HOME will be set by the OGRE SDK installer.
OSX
OSX users may use our Xcode project. It is located in org.ogre4j/src/c/scripts/ogre4j_xcode. It uses the Java and Carbon Framworks of the System. To find the OGRE framework is utilizes a user defined variable called OGRE_FRAMEWORK which defaults to /Library/Frameworks/Ogre.framework.
Other
The provided build.xml contains the target ogre4j.build.c to build the C++ part. To use it you need to have a compiler on PATH (that means on Windows you usually have to use a Visual Studio console). The environment variable JAVA_HOME must be set and it requires an OGRE_HOME in the style of the OGRE Windows SDK. Under Linux you could set that env var to a dir containing two symlinks. One called "include" which points to /usr/local/include/OGRE/ or ogre/OgreMain/include. The other symlink must be called "lib" and point to /usr/local/lib/ or ogre/OgreMain/src/.libs/. As this ant script is not aware of OSX frameworks, you cannot use it on OSX.
Which OGRE SDK to use?
Windows
If you want to use our prebuilt windows dll, you can use a prebuilt OGRE SDK, too. Since version 1.4.9 we build ogre4j with Visual Studio 2005 (== 8.0) so you need that OGRE SDK. Previous versions have been built with Visual Studio 2003 (== 7.1). Make sure version numbers of OGRE and ogre4j match.
OSX
The OGRE team provides only one OSX SDK, pick that ;). It contains Ogre.framework in OgreSDK/Dependencies. Our prebuilt OSX binaries are linked against that framework. For development it is an easy way to copy it to /Library/Frameworks/ but you should include it when you depoly own applications. Note that the OGRE SDK contains only intel binaries and thus our binaries do so as well. To get ppc or universal binaries you have to build OGRE and ogre4j on your own.
MS VC++ Redistributable
On windows you need the Microsoft Visual C++ Redistributable Package for the correct version of Visual Studio. See above which version this is. Download 2005 from Microsoft
Running an Application
First of all, ogre4j.jar must be on classpath. Then the native libs and resources must be found. The ogre4j library (ogre4j.dll, libogre4j.so or libogre4j.dylib) is loaded by the JVM which searches it in the system property java.library.path.
OGRE and it's dependencies are loaded by the OS. Windows looks for it in some directories. UNIX uses the environment variable LD_LIBRARY_PATH. On OSX you can put the Ogre.framework at /Library/Frameworks/.
Resources are usually tried to load from the working dir.
The easiest way to get started is to put everything in the working dir and set PATH or LD_LIBRARY_PATH accordingly.
