N00b problem - display error. [resolved]

Started by SgtSparky, July 22, 2009, 14:12:27

Previous topic - Next topic

SgtSparky

Hello, I believe I'm doing something incredibly wrong here, but I'm not sure what.
Here's what I've done:
1. Created a new project in eclipse.
2. Referenced all the external lwjgl jar files.
3. Copy and pasted all the simple rendering code into a Main.java file (I just renamed the class).
4. Attempted to run this code.

The only errors I get from this are exceptions having to do with destroying the display:

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.opengl.Display -- I bet it is the issue, but I'm not sure how to solve it.
   at t2.Main.cleanup(Main.java:107) -- Actual code: "Display.destroy();"
   at t2.Main.main(Main.java:42) -- Actual code: "cleanup();"

The only thing I really want is to get right now is rendering with primitives so that I can visually test my engine (t2) as I work on it.

Thanks and sorry,
--SgtSparky

broumbroum

your runtime classpath should be notified of lwjgl.jar and others. ;)

SgtSparky

Quote from: broumbroum on July 22, 2009, 20:42:02
your runtime classpath should be notified of lwjgl.jar and others. ;)

I tried adding all the .jar files to my class-path but I still get the same errors. :(
I might be doing something horribly wrong with eclipse. I'm going to try experimenting.

Edit: This image might help a bit.

EDIT again: YAY! I get a window to pop up, but nothing will show up. :( Time for more experimenting..

princec

Ah that simple rendering code is missing a call to gluOrtho2D to set up an orthographic display projection (ie. normal 2D coordinates). LWJGL 1.x used to do that at init, but 2.x no longer does (probably not a wise move on reflection).

Cas :)

broumbroum

Classpath seems ok, maybe you have a file that is elsewhere and overlapping the classpath entries. That may be somewhere in a bootstrap entry : have a look at jre/lib/ext or jdk/jre/lib/ext folders. Also, if you've downloaded a .jnlp and exited by mistake while loading it may be possible that you have to cleanup the java caches in the Java panel.

SgtSparky

Quote from: broumbroum on July 23, 2009, 12:17:30
Classpath seems ok, maybe you have a file that is elsewhere and overlapping the classpath entries. That may be somewhere in a bootstrap entry : have a look at jre/lib/ext or jdk/jre/lib/ext folders. Also, if you've downloaded a .jnlp and exited by mistake while loading it may be possible that you have to cleanup the java caches in the Java panel.

I solved my compile problem yesterday, but thanks for replying. :)
I also solved my display issue: I had to set up glViewPort and glOrtho to fix positioning issues. (Nothing was showing up because the coordinates translation)

Now I have one problem left: How do I get my display to NOT be the size of my desktop? Are there some arguments I can pass on run-time?

princec

Use the create() method on Display that takes a DisplayMode, and construct a DisplayMode with whatever dimensions you want to use to give it.

Cas :)

SgtSparky

Quote from: princec on July 24, 2009, 12:50:41
Use the create() method on Display that takes a DisplayMode, and construct a DisplayMode with whatever dimensions you want to use to give it.

Cas :)

Thanks, problem solved!
..But now I feel like even worse of a noobie for not seeing that in the documentation.  :-[
Oh well, I'm on my way to having a good understanding of lwjgl! :D