Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Help with LWJGL?  (Read 4175 times)
0 Members and 1 Guest are viewing this topic.
the_jogler
Guest
« Posted 2007-09-02 00:23:41 »

How is LWJGL different than JOGL? I know LWJGL is a game engine, but doesn't Java already have support for input and things like that, so why even use a game engine (like LWJGL)? Isn't that like reinventing the wheel? I would just like to know how LWJGL is so different than just using something else, such as JOGL. This is probably a really dumb question, but please bear with me. Thanks.

Edit: I can't find too many tutorials, either. I've tried that NeHe website, but when I download all I get is a .jar fle.
Offline cylab

JGO Ninja


Medals: 38



« Reply #1 - Posted 2007-09-02 01:04:37 »

LWJGL and JOGL were developed in parallel, so they both invented the wheel in the first time Smiley JOGL is some more official, since sun is involved in the development and LWJGL is more community driven. JOGL is "only" an OpenGL binding, while LWJGL also adds sound and input processing not available in standard JRE, like Joystick support and a more direct input response.

There are other differences in window/fullscreen handling etc. and I think the majority of people here consider LWJGL more suited for games, while JOGL is more suited for integration in Desktop Apps like 3D-Editors or Visualization.

Mathias - I Know What [you] Did Last Summer!
the_jogler
Guest
« Reply #2 - Posted 2007-09-02 01:38:45 »

Thanks. But it's kind of hard to find tutorials for LWJGL, seeing as how the wiki doesn't really have tutorials on how to use LWJGL, and the information it does have just kind of makes you jump right in and doesn't really explain things. And why not just use Java 3D or something like that?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #3 - Posted 2007-09-02 02:06:42 »

Thanks. But it's kind of hard to find tutorials for LWJGL, seeing as how the wiki doesn't really have tutorials on how to use LWJGL, and the information it does have just kind of makes you jump right in and doesn't really explain things. And why not just use Java 3D or something like that?
this is pretty straightforward...
http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/opengl/basicopengl

the rest is just OpenGL ...

Offline f.l.x

Senior Member


Projects: 3


there is no place like 127.0.0.1


« Reply #4 - Posted 2007-09-02 02:17:10 »

Edit: I can't find too many tutorials, either. I've tried that NeHe website, but when I download all I get is a .jar fle.

jar files are just zipped (or pack2000) files, unzip with wathever compression software you are used to and ther you are

Litterarum radices amaras, fructus dulces
http://flx.proyectoanonimo.com
figth spam!
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #5 - Posted 2007-09-02 03:36:03 »

>LWJGL and JOGL were developed in parallel, so they both invented the wheel in the first time[...]

LWJGL exists longer.

>jar files are just zipped (or pack2000) files[...]

Jars are Zip files with an optional meta-inf/manifest.mf entry. The file extension for Pack200 (not 2000) is "pack". It doesn't make any sense to distribute files in that flavor, however. You either use GZip compression on top or a different compression scheme (and "pack" files are only a sub step if you take that route - otherwise it's "pack.gz").

弾幕 ☆ @mahonnaiseblog
the_jogler
Guest
« Reply #6 - Posted 2007-09-03 06:58:33 »

So how do I turn a .jar file into something I can read and understand?
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #7 - Posted 2007-09-03 07:43:27 »

just extract it using a zipping program. You might have to rename the file to .zip

Offline flipperke

Junior Member





« Reply #8 - Posted 2007-09-03 13:27:50 »

Or, on the console, type:
1  
jar -xvf jarred_file.jar
Offline Galgalid

Senior Newbie




L33T


« Reply #9 - Posted 2007-10-27 16:19:06 »

Got a question: I've tried using lwjgl with both NetBeans and JCreator...but it's not working. I followed the installation guides for both IDE's(http://lwjgl.org/installation.php) but it's still not working. Funny thing is that it has worked before, so I know I'm doing it right. I used this example to test lwjgl: http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/opengl/basicopengl

In JCreator I get the following error message:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
--------------------Configuration: Space Invaders - j2sdk1.4.2_15 <Default> - <Default>--------------------
java.lang.NoClassDefFoundError: Game (wrong name: game)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
Exception in thread "main"
Process completed.


and in NetBeans IDE 5.0:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
init:

deps-jar:

Compiling 1 source file to C:\Documents and Settings\eng06itara\Game\build\classes

compile:

run:

java.lang.NoClassDefFoundError: C:\Documents

Exception in thread "main"

Java Result: 1

BUILD SUCCESSFUL (total time: 3 seconds)


And yes, I have entered the correct path to lwljgl1.1.2(C:\Documents and Settings\eng06itara\Skrivbord\lwjgl-1.1.2\lwjgl-1.1.2)

Please help me Smiley

I've never before built a program this stable, this secure, this L33T....

I want to be a member of the Sega Black Ops Team!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline GDX

Senior Newbie





« Reply #10 - Posted 2007-10-27 18:38:35 »

I haven't used NetBeans or JCreator, but I have seen errors like those before...

The first error is a classpath issue and so if you can find a way to configure the classpath for the java command that is used to run the code, I think it may resolve the issue.

The second error looks like it has to do with a file path that uses spaces. Notice how the error message cut off the path right after C:\Documents? If you can quote the path, as in...
java -classpath "C:\Documents and Settings\eng06itara\Game\build\classes" (full name of class w/package), it should work.

As I said, I haven't used those IDEs and so hopefully someone can answer for those specifically, but I thought these suggestions might help you.
Offline Galgalid

Senior Newbie




L33T


« Reply #11 - Posted 2007-10-27 22:38:59 »

Now I get the following message in JCreator:
1  
2  
3  
4  
5  
6  
java.lang.NoClassDefFoundError
    at Game.cleanup(Game.java:105)
    at Game.main(Game.java:40)
Exception in thread "main"
Process completed.
 
 

here's the code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
 
/**
 * Basic game
 *
 * @author Name <email>
 * @version 1.0
 */

public class Game {
 
  /** Game title */
  public static final String GAME_TITLE = "My Game";
 
  /** Desired frame time */
  private static final int FRAMERATE = 60;
 
  /** Exit the game */
  private static boolean finished;
 
  /** Angle of rotating square */
  private static float angle;
 
  /**
   * Application init
   * @param args Commandline args
   */

  public static void main(String[] args) {
    boolean fullscreen = (args.length == 1 && args[0].equals("-fullscreen"));
 
    try {
      init(fullscreen);
      run();
    } catch (Exception e) {
      e.printStackTrace(System.err);
      Sys.alert(GAME_TITLE, "An error occured and the game will exit.");
    } finally {
      cleanup();
    }
    System.exit(0);
  }
 
  /**
   * Initialise the game
   * @throws Exception if init fails
   */

  private static void init(boolean fullscreen) throws Exception {
    // Create a fullscreen window with 1:1 orthographic 2D projection (default)
   Display.setTitle(GAME_TITLE);
    Display.setFullscreen(fullscreen);
 
    // Enable vsync if we can (due to how OpenGL works, it cannot be guarenteed to always work)
   Display.setVSyncEnabled(true);
 
    // Create default display of 640x480
   Display.create();
  }
 
  /**
   * Runs the game (the "main loop")
   */

  private static void run() {
 
    while (!finished) {
      // Always call Window.update(), all the time - it does some behind the
     // scenes work, and also displays the rendered output
     Display.update();
 
      // Check for close requests
     if (Display.isCloseRequested()) {
   finished = true;
      }
 
      // The window is in the foreground, so we should play the game
     else if (Display.isActive()) {
        logic();
        render();
        Display.sync(FRAMERATE);
      }
 
      // The window is not in the foreground, so we can allow other stuff to run and
     // infrequently update
     else {
        try {
          Thread.sleep(100);
        } catch (InterruptedException e) {
        }
        logic();
 
   // Only bother rendering if the window is visible or dirty
       if (Display.isVisible() || Display.isDirty()) {
          render();
        }
      }
    }
  }
 
  /**
   * Do any game-specific cleanup
   */

  private static void cleanup() {
    // Close the window
   Display.destroy();
  }
 
  /**
   * Do all calculations, handle input, etc.
   */

  private static void logic() {
    // Example input handler: we'll check for the ESC key and finish the game instantly when it's pressed
   if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
      finished = true;
    }
 
    // Rotate the square
   angle += 2.0f % 360;
  }
    /**
   * Render the current frame
   */

  private static void render() {
    // clear the screen
   GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);
 
    // center square according to screen size
   GL11.glPushMatrix();
    GL11.glTranslatef(Display.getDisplayMode().getWidth() / 2, Display.getDisplayMode().getHeight() / 2, 0.0f);
 
      // rotate square according to angle
     GL11.glRotatef(angle, 0, 0, 1.0f);
 
      // render the square
     GL11.glBegin(GL11.GL_QUADS);
        GL11.glVertex2i(-50, -50);
        GL11.glVertex2i(50, -50);
        GL11.glVertex2i(50, 50);
        GL11.glVertex2i(-50, 50);
      GL11.glEnd();
 
    GL11.glPopMatrix();
  }
}


Maybe i should just try to re-install everything and clean up the mess it has turned into and then give it another try  Undecided

I've never before built a program this stable, this secure, this L33T....

I want to be a member of the Sega Black Ops Team!
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #12 - Posted 2007-10-28 14:35:00 »

You simply don't have the lwjgl.jar in your runtime classpath; and/or the lwjgl.dll, which needs to be pointed at with -Djava.library.path

Cas Smiley

Offline Galgalid

Senior Newbie




L33T


« Reply #13 - Posted 2007-10-28 21:31:58 »

Okay....I tried that command -Djava... and the window creation worked. Then I tried compiling the openGL-test from the cmd, but I got errors. All of them because org.lwjgl.* wasn't found. What do I do now?

btw, gonna try to get it working with JCreator and Netbeans within 2 hours.

I've never before built a program this stable, this secure, this L33T....

I want to be a member of the Sega Black Ops Team!
Offline Galgalid

Senior Newbie




L33T


« Reply #14 - Posted 2007-10-29 00:18:32 »

It's working now Smiley In Netbeans. Good thing, cause I don't like JCreator Wink

I've never before built a program this stable, this secure, this L33T....

I want to be a member of the Sega Black Ops Team!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (25 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!