Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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  
  Installation?  (Read 1967 times)
0 Members and 1 Guest are viewing this topic.
Offline nickdotjava

Junior Member




I have fallen to the dark side.  I'm using DX9


« Posted 2003-06-01 21:17:52 »

I can't find documentation on where to install LWJGL to.  Assuming that java is installed to D:\j2sdk1.4.1_03, where should I extract LWJGL to?

Thanks.

-Nick

-Nick

"Oh ya, that's trivial.  I should have it done in an hour."
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #1 - Posted 2003-06-01 21:43:16 »

whatever folder you want to...
just make sure that the lwjgl.jar is on the classpath (-cp <dir\to\lwjgl\>lwjgl.jar) and that the lwjgl.dll is on your library path (or same dir as where you are executing) (-Djava.library.path=<dir\to\lwjgl>)

Offline Kommi

Junior Member




All opinions will be lined up and shot!


« Reply #2 - Posted 2003-06-04 02:25:07 »

When I dl the zip file with lwjgl and extract it to a folder there is a lwjgl.jar file. Do I need to extract that as well?

Also how do I run a class file that uses lwjgl? what besides    C:\<dir>\java test  do I have to type in the command line?

Kommi
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Kommi

Junior Member




All opinions will be lined up and shot!


« Reply #3 - Posted 2003-06-05 01:33:29 »

I am relly having trouble geting anyhing lwjgl to run. I exract the zip to a directory and set the class path to that directory. I have the dll in the same directory as that of the file I am trying to run but I keep getting the
NoSuchMethodError's for org.lwjgl.Display.create
location:class org.lwjgl.opengl.GL
and
symbol  : method destroy ()
location: class org.lwjgl.Display
Display.destroy();

what am I doing wrong with the setup of lwjgl?                                                            

Kommi
Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #4 - Posted 2003-06-05 02:12:50 »

You need to set your classpaths explicitly to the jars not just the directory they are in...

java -classpath .;lwjgl.jar;examples.jar SomeTest

You are also going to have to make sure the dll is in your library path... either in a directory that is set in PATH or use

-Djava.library.path=.

Don't send a man to do a monkey's work.
Offline Kommi

Junior Member




All opinions will be lined up and shot!


« Reply #5 - Posted 2003-06-05 02:21:04 »

Thanx I figured it out. I was using demos from .5 with lwjgl .6 in which methods like create and desroy were depreciated

Kommi
Offline nickdotjava

Junior Member




I have fallen to the dark side. &nbsp;I'm using DX9


« Reply #6 - Posted 2003-06-07 17:55:15 »

I'm using Windows XP Home.  I've set the classpath in environment variables to c:\lwjgl\ and extracted all files in the .zip to there.  I also extracted all files to where the .java I'm trying to compile is.  I get the error
D:\PROGRAM FILES\Xinox Software\JCreator LE\MyProjects\lwjgl test\Game.java:1: package org.lwjgl does not exist
import org.lwjgl.*;

Any ideas?

-Nick

"Oh ya, that's trivial.  I should have it done in an hour."
Offline Mojomonkey

Senior Member




ooh ooh eee eeee


« Reply #7 - Posted 2003-06-07 18:14:25 »

Did you set your classpath to the jars in your directory, or just the directory itself?

ie:

CLASSPATH=C:\mydir\lwjgl.jar;C:\mydir\another.jar

or

CLASSPATH=C:\mydir

the first should work...

Don't send a man to do a monkey's work.
Offline nickdotjava

Junior Member




I have fallen to the dark side. &nbsp;I'm using DX9


« Reply #8 - Posted 2003-06-07 19:34:19 »

Woo hoo!  I got it to work!   Cheesy

Now the trick is getting it to compile.  I'm taking the code directly from the skeleton code from the documentation at java-game-lib.sourceforge.net.  Here are my problems:

Display.Create(...)  Doesn't exist anymore.  What replaced it?

It doesn't know what GL is.  Do I need to reference other .jar files other than lwjgl.jar?

it say swapBuffers(...) is private.  So how do I use it?

And it has no idea what display.destroy is.  For reference, I've posted the code I copied below.

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  
145  
146  
147  
148  
149  
150  
import org.lwjgl.*;
import org.lwjgl.opengl.*;
import org.lwjgl.input.*;

import java.nio.*;

public final class Game {
  static {
    try {
      //find first display mode that allows us 640*480*16
     int mode = -1;
      DisplayMode[] modes = Display.getAvailableDisplayModes();
      for (int i = 0; i < modes.length; i++) {
        if (modes[i].width == 640
          && modes[i].height == 480
          && modes[i].bpp >= 16) {
          mode = i;
          break;
        }
      }

      //select above found displaymode
     Display.create(modes[mode], false);
      System.out.println("Created display.");
    } catch (Exception e) {
      System.err.println("Failed to create display due to " + e);
      System.exit(1);
    }
  }

  public static final GL gl = new GL();
  public static final GLU glu = new GLU(gl);

  static {
    try {
      gl.create();
      System.out.println("Created OpenGL.");
    } catch (Exception e) {
      System.err.println("Failed to create OpenGL due to " + e);
      System.exit(1);
    }
  }

  /** Is the game finished? */
  private static boolean finished;

  /** A rotating square! */
  private static float angle;

  /**
    * No construction allowed
    */

  private Game() {
  }

  public static void main(String[] arguments) {
    try {
      init();
      while (!finished) {
        Keyboard.poll();

        mainLoop();

        render();

        gl.swapBuffers();
      }
    } catch (Throwable t) {
      t.printStackTrace();
    } finally {
      cleanup();
    }
  }

  /**
    * All calculations are done in here
    */

  private static void mainLoop() {
    angle += 1f;
    if (angle > 360.0f)
      angle = 0.0f;

    if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
      finished = true;
    }
  }

  /**
    * All rendering is done in here
    */

  private static void render() {
    gl.clear(GL.COLOR_BUFFER_BIT);
    gl.pushMatrix();
    gl.translatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);
    gl.rotatef(angle, 0, 0, 1.0f);
    gl.begin(GL.QUADS);
    {
      gl.vertex2i(-50, -50);
      gl.vertex2i(50, -50);
      gl.vertex2i(50, 50);
      gl.vertex2i(-50, 50);
    }
    gl.end();
    gl.popMatrix();
  }

  /**
    * Initialize
    */

  private static void init() throws Exception {
    System.out.println("Press the ESCAPE key to exit");
   
    Keyboard.create();

    //reset time
   Sys.setTime(0);

    //set priority of this process
   Sys.setProcessPriority(Sys.LOW_PRIORITY);

    //print timer resolution info
   System.out.println("Timer resolution: " + Sys.getTimerResolution() + " ticks per second");

    // Go into orthographic projection mode.
   gl.matrixMode(GL.PROJECTION);
    gl.loadIdentity();
    glu.ortho2D(0, Display.getWidth(), 0, Display.getHeight());
    gl.matrixMode(GL.MODELVIEW);
    gl.loadIdentity();
    gl.viewport(0, 0, Display.getWidth(), Display.getHeight());

    //lets print out some info
   ByteBuffer num_tex_units_buf = ByteBuffer.allocateDirect(4);
    num_tex_units_buf.order(ByteOrder.nativeOrder());
    int buf_addr = Sys.getDirectBufferAddress(num_tex_units_buf);
    gl.getIntegerv(GL.MAX_TEXTURE_UNITS_ARB, buf_addr);

    System.out.println(
      "Number of texture units: " + num_tex_units_buf.getInt());
  }

  /**
    * Cleanup
    */

  private static void cleanup() {
    Keyboard.destroy();
    gl.destroy();
    Display.destroy();
  }
}

-Nick

"Oh ya, that's trivial.  I should have it done in an hour."
Offline elias

Senior Member





« Reply #9 - Posted 2003-06-07 19:46:40 »

The skeleton code is old and outdated - use one of the examples in the cource distribution for now.

- elias

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline nickdotjava

Junior Member




I have fallen to the dark side. &nbsp;I'm using DX9


« Reply #10 - Posted 2003-06-07 23:58:01 »

I'm assuming you're talking about lwjgl_examples.jar?

-Nick

"Oh ya, that's trivial.  I should have it done in an hour."
Offline elias

Senior Member





« Reply #11 - Posted 2003-06-08 07:23:19 »

Not quite - the jar contains the class files but you need the java files. They are in the source distribution on SF.

- elias

Offline nickdotjava

Junior Member




I have fallen to the dark side. &nbsp;I'm using DX9


« Reply #12 - Posted 2003-06-09 21:58:04 »

Too late.  I used a decompiler.   Grin

-Nick

"Oh ya, that's trivial.  I should have it done in an hour."
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #13 - Posted 2003-06-17 14:22:43 »

Quote
Too late.  I used a decompiler.   Grin


ROFL! Grin

Hellomynameis Charlie Dobbie.
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.

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

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

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

Riven (20 views)
2014-07-23 20:56:16

ctomni231 (48 views)
2014-07-18 06:55:21

Zero Volt (44 views)
2014-07-17 23:47:54

danieldean (35 views)
2014-07-17 23:41:23

MustardPeter (38 views)
2014-07-16 23:30:00

Cero (53 views)
2014-07-16 00:42:17

Riven (52 views)
2014-07-14 18:02:53
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

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!