First attempt at jme

first of all, great work with jme mojo, i have only been programming java for a few months now, and i am finding it very easy, alot easier than Java3D or Xine3D, top stuff



i am following your tutorials, i have just completed the defining the camera in teh blue universe. however, when i goto run the project, i am shown the resolution properties box, when i click ok, the project runs for abotu 10 seconds, nothing appears on screen, then the process terminates.



i am using netbeans IDE, the latest jME and lwjgl 0.8, Linux Gentoo on an nVidia geForce 4 mx 440 with latest drivers



no errors are reported on the projects output, it is very silent (textually)



i read that you had to change a line of code in jME to get 0.8 working, is that updated in teh jar, or just on cvs?





once again great work

I had a similar problem a while back with lwjgl 0.8, Win2000 & my Matrox dualhead card. I had the latest drivers, but until I had been through all the possible alternatives at driverguide.com I could not get it to work. In the end a friend sent me an obscure win2000 driver for it which worked.



Does any other Java OpenGL stuff like JOGL or Java3D work OK?, because if it does the problem seems to point to lwjgl & your drivers.



Might be a good idea to search through the messages at puppygames.net in the lwjgl forum to see if anyone else has or has had the same problem.

both Java3D and JOGL work, i dont believe that i have tried any LWJGL demo apps, however i suspect that LWJGL is at fault, the only odd thing is that the instalation appears to be correct, everything is in the correct folder and the .jars are all in my classpath

Try running one of the tests in jME and see if that works. Another very possible possiblility is that those tutorials are getting out of date, and something may have changed enough to not allow them to work.



Try running com.jme.test.milestone.TestMilestone2



If that runs, then the culprit is the tutorials fell out of date. And that’s entirely my fault.

nope, running any of the tests returns teh same result, the dialog box comes up, i accept the settings, then it thinks, and exits



when i ran MileStone2 i recieved a few messages about it creating boxes which indicates to me that it is simply unable to render

i have tried the NeHe opengl lwjgl tutorials, the first few work, drawing the screen etc, however, then at about tutorial 5 when they get into skinning etc the tutorials fail to work due ot negative height and width

Could you paste the entire log output for any of the jME tests? I’ll see if there is any clue in them. Also, tell me:



How you are running the demo/test.

What directory you are running them in.

when running jmeTest (the program i copied from tutorials)

Jan 12, 2004 9:43:04 PM com.jme.app.AbstractGame start
INFO: Application started.
Jan 12, 2004 9:43:04 PM com.jme.system.PropertiesIO <init>
INFO: PropertiesIO created
Jan 12, 2004 9:43:04 PM com.jme.system.PropertiesIO load
INFO: Read properties
Jan 12, 2004 9:43:12 PM com.jme.system.PropertiesIO save
INFO: Saved properties



when running the Milestone2 example

Jan 12, 2004 9:44:36 PM com.jme.app.AbstractGame start
INFO: Application started.
Jan 12, 2004 9:44:37 PM com.jme.system.PropertiesIO <init>
INFO: PropertiesIO created
Jan 12, 2004 9:44:37 PM com.jme.system.PropertiesIO load
INFO: Read properties
creating box at: 8.120672 5.8516097 8.997915
creating box at: 3.4776285 8.669021 1.756478
creating box at: 3.7090054 2.231083 0.8412907
creating box at: 7.86268 7.7400494 0.09833441
creating box at: 2.8609264 2.483417 1.0300188
Jan 12, 2004 9:44:52 PM com.jme.system.PropertiesIO save
INFO: Saved properties



i am using netbeans, i have loaded the following jars into the classpath:
jogl
jsdl
lwjgl
xith3d
j3dcore
j3daudio
j3dutils
rt
jl030
jme
java3dgamesdk

the only jars that i am aware of that are required by jme are
jme.jar
rt.jar
jl030.jar (java layer)
lwjgl.jar

i have tried rendering using every setting avaliable in the properties dialog

here is the code of my jmeTest (i doubt it is the problem)

import com.jme.app.AbstractGame;
import com.jme.entity.Entity;
import com.jme.input.*;
import com.jme.input.action.*;
import com.jme.intersection.*;
import com.jme.light.*;
import com.jme.math.*;
import com.jme.renderer.*;
import com.jme.scene.*;
import com.jme.scene.state.*;
import com.jme.system.*;


public class jmeTest extends com.jme.app.AbstractGame {
   
    Camera cam;
   
    protected void update() {
        //do all updating in here
        cam.update();
       
    }
   
    protected void render() {
        //draw in here
       
        display.getRenderer().clearBuffers();
    }
   
    protected void initSystem() {
        //initialize the main system such as display and camera here
       
        //make a window
        try {
            if("LWJGL".equalsIgnoreCase(properties.getRenderer())) {
                display = new LWJGLDisplaySystem();
                display.createWindow(properties.getWidth(), properties.getHeight(), properties.getDepth(), properties.getFreq(), properties.getFullscreen());
               
                //make the camera
                cam = new LWJGLCamera(properties.getWidth(), properties.getHeight());
            }
        } catch (JmeException e) {
            e.printStackTrace();
            System.exit(1);
        }
       
        display.getRenderer().setBackgroundColor(new ColorRGBA(0,0,1,1));
       
        cam.setFrustum(1.0f, 1000.0f, -0.55f, 0.55f, 0.4125f, -0.4125f);
        Vector3f loc = new Vector3f(4,0,0);
        Vector3f left = new Vector3f(0, -1, 0);
        Vector3f up = new Vector3f(0, 0, 1);
        Vector3f dir = new Vector3f(-1, 0, 0);
       
        cam.setFrame(loc, left,  up,  dir);
        display.getRenderer().setCamera(cam);
    }
   
    protected void initGame() {
        //initialize game components such as the scene graph in here
    }
   
    protected void reinit() {
        //handle re-initialization of any required components if a screen resolution change or similar occurs
    }
   
    protected void cleanup() {
        //do any last minute cleanup before teh application exits
    }
   
    public static void main(String[] args) {
        jmeTest app = new jmeTest();
        app.useDialogAlways(true);
        app.start();
    }
}



i am aware that i have imported pretty much everything, however, i was just testing functions at the time of writing this


i have just run teh project in the debugger, here is the output;

/opt/j2sdk_nb/j2sdk1.4.2/bin/java -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=Daem0hns.Linux.b0x:33025,suspend=y -Djava.compiler=NONE -classpath "/home/mike/.netbeans/3.5/system:/home/mike/.netbeans/3.5/system:/opt/j2sdk_nb/netbeans3.5.1/system:/opt/j2sdk_nb/netbeans3.5.1/modules/ext/AbsoluteLayout.jar:/opt/j2sdk_nb/netbeans3.5.1/modules/autoload/ext/servlet-2.3.jar:/opt/j2sdk_nb/netbeans3.5.1/lib/ext/xml-apis-1.0b2.jar:/opt/j2sdk_nb/netbeans3.5.1/beans/TimerBean.jar:/home/mike/java/jme:/opt/j2sdk_nb/j2sdk1.4.2:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/j3daudio.jar:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/j3dcore.jar:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/j3dutils.jar:/opt/j2sdk_nb/j2sdk1.4.2/lib/jogl.jar:/opt/j2sdk_nb/j2sdk1.4.2/lib/jsdl.jar:/opt/j2sdk_nb/j2sdk1.4.2/java3d-utils-src.jar:/opt/j2sdk_nb/j2sdk1.4.2/lib/java3dgamesdk.jar:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/rt.jar:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/lwjgl.jar:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/xith3d.jar:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/jl030.jar:/opt/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/jme.jar:/home/mike/.netbeans/3.5/tomcat406_base" jmeTest "-ea"





if there is anything else you need to know, just ask, jme looks really great, and i really want to get it working, going to try other stuff, thanks for the help

Mike

Ok, I just did a straight cut and paste of your code, and it ran perfectly fine. I got a window with a blue background, stayed until I closed it. I’m at a loss as to what is going on. Make sure your drivers are up to date, and you might bring it up to the puppygames.net (LWJGL) folks. As mentioned above, Big_Bluey went through some of the same things. Sorry I can’t be of further help.

i have updated drivers, still not working, howeevr i am wondering whether i have the .so (.dll) files in the correct location



would you be able to tell me where you have placed your lwjgl dll files



i have tried my projetc on windows 98SE andstill it doesnt work (same problem), i am wondering whether this is because of incorrectly placed .dll files



does any errors produced by lwjgl appear in jme output???

I do have no problems when running jme on my computer (suse linux 8.2; a NVIDIA graphic card). Do you choose the right frequency. You have to select

0
as frequency. You also must set the -Djava.library.path=… system property when you run the java

interpreter. It must point to a directory conaining the

liblwjgl.so

version 0.8 file.

Don’t know if this helps. What I do is create a batch file for each app I write as they are fairly small & this works fine:



javac -classpath .;libjme.jar;liblwjgl.jar;.libjl030.jar TestApp.java
set CLASSPATH=.;.libjme.jar;.liblwjgl.jar;.libjl030.jar
java -Djava.library.path=.lib TestApp



I've put all the jars I need (lwjgl, jME & jl030) plus the lwjgl dll file in a directory called lib. This I preffer to than adding more stuff to my win2000 classpath. The batch file above compiles & runs everything I need to use jME. I don't tend to use eclipse, I usually use a text editor & dos window.


Hope this helps :)

I see the exception is thrown within this block:

     
68 try {
69            System.loadLibrary("lwjgl");
70 } catch (UnsatisfiedLinkError e) {
71           throw new JmeException("LWJGL library not set.");
72 }


Such an

UnsatisfiedLinkError

occurs when the native libraries cannot be located. In this case it is the

liblwjgl.so


file. Check again the -Djava.library.path=... flag.

Make sure the -Djava.library.path= is pointing to the directory that contains the .so or .dlls, not the dll/so itself.



that is, if lwjgl is in: C:jmetestliblwjgl.dll



and you are running from C:jmetest



the path would be: -Djava.library.path=./lib



This is different than say classpath jars. Which you point to the jar file itself.

Gah. I suppose I forgot to log in! Eh, such is life. Besides, I forgot to menton that I am using the most recent drivers - 53.03 - for my [aging] GeForce 3.

Hmmm thanks for this. I’ll ask around and compare the initDisplay method to see if I’m doing something stupid. Sorry it’s not working for you, I’ll try to get it up soon!

Sure enough, I’m exiting without displaying the exception. Not smart. Are you working with the source or the jar? If you are working with the source, could you add:



e.printStackTrace();



to like 215ish in LWJGLDisplaySystem?



} catch (Exception e) {

e.printStackTrace();

System.exit(1);

}



and then try. See what it says.



Thanks

Well, I’ve managed to track down the error myself. It all had to do with assuming a certain video mode existed on my machine, when it actually did not. Grr. Anyhow, I’m still going to blame this whole escapade on you carelessly throwing away the exception :stuck_out_tongue: . Why not simply throw an Error instead? Still forces the program to terminate, like before, but also is a little more … verbose.



On a related note: perhaps it would be a good idea to have the properties dialog display only those display modes which exist? I could try to do a quick implementation, if you’re interested. I could see two possible ways to do it: show a list of all avaiable display modes, or filter out those of the “predefined” that are invalid.



Oh, and add an option for 85Hz, please. Just for me. :smiley:


  • Eric

Please do. I’ve done this two ways. First version put a list up of every mode returned by LWJGL, but this contained invalid modes as well and was ALOT. Then I just created a “typical” list for the new one. But if you have a way to do it, I’d be more than happy to add it into the base code. And don’t worry that Exception is handled a tad bit better now. :slight_smile:

I’ve gone ahead and made some changes to the properties dialog box. I opted for a “compromise” approach: invalid modes are not culled, however they are tested for validity before being accepted. I modified the DisplaySystem slightly to accomplish this, so an isValidDisplayMode method is now part of the class. I also separated the bit depth from the resolution, adding another combo box. Not drastic changes, I realize, but rather small enhancements.



So, now that I’ve done that, how would you like me to submit the code? Email, CVS, whatever. I’m open.


  • Eric