Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2
1  Java Game APIs & Engines / Java Sound & OpenAL / Re: joal and eclipse on: 2005-10-03 12:01:25
Well didn't have anymore time to wait for an answer so I tried the LWJGL binding instead and that works. Therefore I withdraw this cry for help.
2  Java Game APIs & Engines / Java Sound & OpenAL / joal and eclipse on: 2005-10-03 10:46:50
Hi!
I'm pretty new to ecplise and completely new to joal. So I get the following output when I try to run the tutorial on multiple sources:

Go TEAM!
Entering alutInit()
net.java.games.joal.OpenALException: Could not load openal library.
   at net.java.games.joal.ALFactory.init(Native Method)
   at net.java.games.joal.ALFactory.initialize(ALFactory.java:61)
   at net.java.games.joal.util.ALut.alutInit(ALut.java:61)
   at sound.MultipleSources.main(MultipleSources.java:172)
ALFactory.init - Native: Enter
ALFactory.init - Native: Exit

In my run configuration I've added the joal.jar to the class path under user entries and I give [-Djava.library.path="natives/win32/"] as a VM argument since I've placed joal.dll in the natives/win32 directory of my current project. Does anyone know what to do or does anyone know of any guides on the joal/eclipse combination?
3  Java Game APIs & Engines / OpenGL Development / Re: How to make a game? on: 2004-12-26 05:51:33
Have a look at the following page:

http://nehe.gamedev.net/

A lot of the tutorials can be downloaded in LWJGL specific code thanks to Mark Bernard.
4  Java Game APIs & Engines / OpenGL Development / Re: midi or other background music alternative on: 2004-11-03 13:11:20
I have my information from the following site:

http://www.fmod.org/ifmodfeatures.html

Have a look at the table called "Cross Platform feature chart"
5  Java Game APIs & Engines / OpenGL Development / Re: midi or other background music alternative on: 2004-11-03 11:06:00
A slight problem with FMOD is that it only supports midi on the Windows platforms  :-/
6  Java Game APIs & Engines / OpenGL Development / Re: accumulating javaw processes on: 2004-10-15 14:24:44
Thanks! If sun did this on purpose I really don't follow their idea on this one  Huh
7  Java Game APIs & Engines / OpenGL Development / accumulating javaw processes on: 2004-10-15 13:48:50
Hi!

Every time I run my game http://www.retris.1go.dk a javaw.exe process is left running. Could this be due to lwjgl?
8  Java Game APIs & Engines / OpenGL Development / Re: Where can I get Superelvis? on: 2004-10-10 13:58:52
Generally, the following page is a good place to start when looking for games that uses LWJGL:

http://lwjgl.org/wiki/tiki-index.php?page=Games+Using+LWJGL
9  Java Game APIs & Engines / OpenGL Development / Re: Superelvis on: 2004-10-08 16:13:27
And after removing the binaries the game works perfectly! Nice game by the way!
10  Java Game APIs & Engines / OpenGL Development / Re: Superelvis on: 2004-10-07 14:58:14
Actually I think I have. When I initially tried to get lwjgl up and running I added a lot of things to my class path and copied different jars and binaries to different locations on my hard drive. Could it possibly help do remove this garbage?
11  Java Game APIs & Engines / OpenGL Development / Re: Superelvis on: 2004-10-07 09:31:09
Okay. So what you're saying is that it is probably not my fault. I'll report it as a bug. Are you listening prince_c? (you made superelvis, right?)
12  Java Game APIs & Engines / OpenGL Development / Superelvis on: 2004-10-06 21:31:26
I can't make superelvis run with webstart. I've been able to make other lwjgl run on my computer so I don't know what the problem is. Here the error

General:
1  
2  
3  
4  
5  
6  
7  
An error occurred while launching/running the application.

Title: SUPER ELVIS 0.94-200409172
Vendor: Puppy Games
Category: Unexpected Error

Unexpected exception: java.lang.reflect.InvocationTargetException


Launch File:
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  
<?xml version="1.0" encoding="utf-8"?>

<!-- JNLP File for Hallucinogenesis -->
<jnlp
  spec="1.0+"
  codebase="http://www.puppygames.net/downloads/hallucinogenesis"
  href="hallucinogenesis.jnlp">
  <information>
    <title>SUPER ELVIS 0.94-200409172</title>
    <vendor>Puppy Games</vendor>
    <homepage href="http://www.puppygames.net/"/>
    <description>Shoot things! Collect things! Help Elvis escape a bad trip!</description>
    <description kind="short">Shoot-em-up</description>
    <offline-allowed/>
  </information>
  <security>
      <all-permissions/>
  </security>
  <resources>
    <j2se version="1.4+"/>
    <jar href="hallucinogenesis-code.jar"/>
    <jar href="hallucinogenesis-sprites.jar"/>
    <jar href="hallucinogenesis-sounds.jar"/>
    <jar href="hallucinogenesis-images.jar"/>
    <jar href="hallucinogenesis-fonts.jar"/>
    <jar href="hallucinogenesis-images.jar"/>
    <jar href="hallucinogenesis-game.jar"/>
    <jar href="alloy.jar"/>
    <jar href="lwjgl.jar"/>
    <jar href="gamecommerce.jar"/>
    <jar href="spgl.jar"/>
    <jar href="jogg-0.0.5.jar"/>
    <jar href="jorbis-0.0.12.jar"/>
    <extension href="bc.jnlp" />
  </resources>
  <resources os="Windows">
    <j2se version="1.4+"/>
    <nativelib href="lwjgl-windows.jar"/>
    <nativelib href="openal-windows.jar"/>
  </resources>
  <resources os="Linux" arch="i386">
    <j2se version="1.4+"/>
    <nativelib href="lwjgl-linux.jar"/>
    <nativelib href="openal-linux.jar"/>
  </resources>
  <resources os="MacOS">
    <j2se version="1.4+"/>
    <nativelib href="lwjgl-osx.jar"/>
    <nativelib href="openal-osx.jar"/>
  </resources>
  <j2se version="1.4+" initial-heap-size="40m" max-heap-size="40m" java-vm-args="-Xincgc"/>
  <property key="java.library.path" value="." />
  <application-desc main-class="genesis.Game"/>
</jnlp>


Exception:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.sun.javaws.Launcher.executeApplication(Unknown Source)
      at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
      at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
      at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
      at com.sun.javaws.Launcher.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError
      at genesis.Game.cleanup(Game.java:529)
      at genesis.Game.exit(Game.java:766)
      at genesis.Game.main(Game.java:543)
      ... 11 more


I'm running WINXP on my laptop which has a mobility radeon 9000 graphics card. I've got the same problem on my stationary computer that runs WINXP and has a GeForce 3 Ti200 graphics card.

What could be wrong?
13  Java Game APIs & Engines / OpenGL Development / Re: Does my game work on your machines? on: 2004-09-20 12:14:46
I know about the interlaced lines - but I'm not sure how to fix it. Does anyone have an idea what can be wrong? The image for the texture measures 800x600 pixels and I use the following code to generate the texture:

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  
      private static int loadTexture(String path) {
            java.net.URL url = Thread.currentThread().getContextClassLoader().getResource(path);
            Image image = (new javax.swing.ImageIcon(url)).getImage();

            // Exctract The Image
           BufferedImage tex = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_3BYTE_BGR);
            Graphics2D g = (Graphics2D) tex.getGraphics();
            g.drawImage(image, null, null);
            g.dispose();

            // Flip Image
           AffineTransform tx = AffineTransform.getScaleInstance(1, -1);
            tx.translate(0, -image.getHeight(null));
            AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
            tex = op.filter(tex, null);

            // Put Image In Memory
           ByteBuffer scratch = ByteBuffer.allocateDirect(4 * tex.getWidth() * tex.getHeight());

            byte data[] = (byte[]) tex.getRaster().getDataElements(0, 0, tex.getWidth(), tex.getHeight(), null);
            scratch.clear();
            scratch.put(data);
            scratch.rewind();

            // Create A IntBuffer For Image Address In Memory  
           IntBuffer buf = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
            GL11.glGenTextures(buf); // Create Texture In OpenGL  

           
            // Typical Texture Generation Using Data From The Image

            // Linear Filtering
         GL11.glBindTexture(GL11.GL_TEXTURE_2D, buf.get(0));
          GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
          GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_NEAREST);
            GLU.gluBuild2DMipmaps(GL11.GL_TEXTURE_2D, 3, tex.getWidth(), tex.getHeight(), GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, scratch);

           
            return buf.get(0); // Return Image Address In Memory
     }
14  Java Game APIs & Engines / OpenGL Development / Re: Does my game work on your machines? on: 2004-09-01 07:25:46
Thanks cas!  Smiley

I use LWJGL for rendering and input and pure java for the rest. No JOGL!

edit: And of course php/mysql for the hiscore part. That should cover it  Grin
15  Java Game APIs & Engines / OpenGL Development / Re: Does my game work on your machines? on: 2004-08-31 15:05:33
I changed the few lines with 1.5 specific code to 1.4 compatible code and the compiled it with:

javac -classpath "$[ClassPath]" -d "$[OutputPath]" $[JavaFiles]

The javac.exe is still the 1.5 compiler but it compiles to 1.4 by default.
16  Java Game APIs & Engines / OpenGL Development / Re: Does my game work on your machines? on: 2004-08-27 21:12:38
Nice!  Grin
17  Java Game APIs & Engines / OpenGL Development / Re: Does my game work on your machines? on: 2004-08-27 15:26:08
I meant what I said which was compiling with "bla bla bla" instead of "-source 1.5 bla bla bla". I think 1.4 is the default option so no need to specify it...
Anyway i'm glad it seems to work on most machines. Please let me know if I'm wrong!
18  Java Game APIs & Engines / OpenGL Development / Re: Does my game work on your machines? on: 2004-08-27 14:45:25
Just compiled without option -source 1.5 and it works on all machines I've encountered. Does it work on yours now?
Thanks for your help everyone!

Søren
19  Java Game APIs & Engines / OpenGL Development / Re: Does my game work on your machines? on: 2004-08-27 14:03:50
yup! Compiled using 1.5 SDK! What's the problem with that? Does it work if I change my code to compile with an older version?
20  Java Game APIs & Engines / OpenGL Development / Re: Does my game work on your machines? on: 2004-08-27 13:43:12
Hmm ok. Can u see anything wrong in my php/jnlp file?

Tetris.php:
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  
 <?php header("Content-type: application/x-java-jnlp-file");
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";?>

<jnlp

  spec="1.0+"

  codebase="http://www.retris.1go.dk/"

  href="Tetris.php">

  <information>
    <title>Random</title>
    <vendor>Random Industries</vendor>
    <homepage href="http://www.random.com/"/>
    <description>Random</description>
    <description kind="short">
      A little random toy
    </description>
    <offline-allowed/>
  </information>

  <security>
      <all-permissions/>
  </security>

  <resources>

    <j2se version="1.4+"/>
    <jar href="Tetris.jar"/>
    <jar href="lwjgl.jar"/>

  </resources>

  <resources os="Windows">
    <nativelib       href="lwjgl.win.jar"      />
  </resources>
  <resources os="Linux">
    <nativelib       href="lwjgl.lin.jar"      />
  </resources>
  <resources os="Mac">
    <nativelib       href="lwjgl.mac.jar"      />
  </resources>


  <application-desc main-class="Tetris"/>
</jnlp>
21  Java Game APIs & Engines / OpenGL Development / Re: Does my game work on your machines? on: 2004-08-27 13:01:46
Middy>> Does it freeze at "Starting application" because I've seen that on a number of other machines which all had in common that no lwjgl had been executing on them before.
Any ideas what the problem can be?

Thanks to both of you for using some of your friday afternoon time on this!

Søren
22  Java Game APIs & Engines / OpenGL Development / Re: Does my game work on your machines? on: 2004-08-27 11:45:01
And I would be happy if you would tell me your OS/Browser/GraphicsHardware details wether or not it works  Smiley
23  Java Game APIs & Engines / OpenGL Development / Does my game work on your machines? on: 2004-08-27 11:08:51
Hi!
Just made this tetris clone using lwjgl. I wonder if it works on your machines?
http://www.retris.1go.dk/

Søren Thorsen, Denmark
24  Java Game APIs & Engines / OpenGL Development / Re: Textures overlap on: 2004-07-09 13:15:57
Thank you very much! (from tiels as well)
25  Java Game APIs & Engines / OpenGL Development / Re: Textures overlap on: 2004-07-09 12:29:35
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  
import static org.lwjgl.opengl.GL11.*;

public class Lesson06 extends LWJGL
{
      //private String[] paths = {"pic1.png","pic2.png"};
     private String[] paths = {       "pic1.png"
                                                ,"pic2.png"
                                                ,"pic3.png"
                                                ,"pic4.png"
                                                ,"pic5.png"
                                                ,"pic6.png"};
      private int[] texs;
      private float xrot; // X Rotation ( NEW )
     private float yrot; // Y Rotation ( NEW )
     private float zrot; // Z Rotation ( NEW )
     
      public Lesson06()
      {
            super("Lesson06",true);
      }
     
      protected void render()
      {
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer

            glLoadIdentity(); // Reset The Current Modelview Matrix

            glTranslatef(0.0f, 0.0f, -5.0f); // Move Into The Screen 5 Units
           glRotatef(xrot, 1.0f, 0.0f, 0.0f); // Rotate On The X Axis
           glRotatef(yrot, 0.0f, 1.0f, 0.0f); // Rotate On The Y Axis
           glRotatef(zrot, 0.0f, 0.0f, 1.0f); // Rotate On The Z Axis
           glBindTexture(GL_TEXTURE_2D, texs[0]); // Select Our Texture
           glBegin(GL_QUADS);
                  // Front Face
                 glTexCoord2f(0.0f, 0.0f);
                  glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad
                 glTexCoord2f(1.0f, 0.0f);
                  glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad
                 glTexCoord2f(1.0f, 1.0f);
                  glVertex3f(1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad
                 glTexCoord2f(0.0f, 1.0f);
                  glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad
           glEnd();
            glBindTexture(GL_TEXTURE_2D, texs[5]); // Select Our Texture
           glBegin(GL_QUADS);
                  // Back Face
                 glTexCoord2f(1.0f, 0.0f);
                  glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad
                 glTexCoord2f(1.0f, 1.0f);
                  glVertex3f(-1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad
                 glTexCoord2f(0.0f, 1.0f);
                  glVertex3f(1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad
                 glTexCoord2f(0.0f, 0.0f);
                  glVertex3f(1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad
           glEnd();
            glBindTexture(GL_TEXTURE_2D, texs[2]); // Select Our Texture
           glBegin(GL_QUADS);
                  // Top Face
                 glTexCoord2f(0.0f, 1.0f);
                  glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad
                 glTexCoord2f(0.0f, 0.0f);
                  glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Texture and Quad
                 glTexCoord2f(1.0f, 0.0f);
                  glVertex3f(1.0f, 1.0f, 1.0f); // Bottom Right Of The Texture and Quad
                 glTexCoord2f(1.0f, 1.0f);
                  glVertex3f(1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad
           glEnd();
            glBindTexture(GL_TEXTURE_2D, texs[3]);
            glBegin(GL_QUADS);
                  // Bottom Face
                 glTexCoord2f(1.0f, 1.0f);
                  glVertex3f(-1.0f, -1.0f, -1.0f); // Top Right Of The Texture and Quad
                 glTexCoord2f(0.0f, 1.0f);
                  glVertex3f(1.0f, -1.0f, -1.0f); // Top Left Of The Texture and Quad
                 glTexCoord2f(0.0f, 0.0f);
                  glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad
                 glTexCoord2f(1.0f, 0.0f);
                  glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad
           glEnd();
            glBindTexture(GL_TEXTURE_2D, texs[1]);
            glBegin(GL_QUADS);
                  // Right face
                 glTexCoord2f(1.0f, 0.0f);
                  glVertex3f(1.0f, -1.0f, -1.0f); // Bottom Right Of The Texture and Quad
                 glTexCoord2f(1.0f, 1.0f);
                  glVertex3f(1.0f, 1.0f, -1.0f); // Top Right Of The Texture and Quad
                 glTexCoord2f(0.0f, 1.0f);
                  glVertex3f(1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad
                 glTexCoord2f(0.0f, 0.0f);
                  glVertex3f(1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad
           glEnd();
            glBindTexture(GL_TEXTURE_2D, texs[4]);
            glBegin(GL_QUADS);
                  // Left Face
                 glTexCoord2f(0.0f, 0.0f);
                  glVertex3f(-1.0f, -1.0f, -1.0f); // Bottom Left Of The Texture and Quad
                 glTexCoord2f(1.0f, 0.0f);
                  glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad
                 glTexCoord2f(1.0f, 1.0f);
                  glVertex3f(-1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad
                 glTexCoord2f(0.0f, 1.0f);
                  glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Texture and Quad
           glEnd();

            xrot += 0.3f; // X Axis Rotation
           yrot += 0.2f; // Y Axis Rotation
           zrot += 0.4f; // Z Axis Rotation
     }
     
      protected void loadTextures()
      {
            texs=Texture.loadTexture(paths);
      }
     
      public static void main(String[] args)
      {
            (new Lesson06()).start();
      }      
}
26  Java Game APIs & Engines / OpenGL Development / Re: Textures overlap on: 2004-07-09 12:29:19
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  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
/* Standard imports.
 */


import org.lwjgl.*;
import org.lwjgl.input.*;
import org.lwjgl.opengl.*;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;

import org.lwjgl.fmod.FMOD;
import org.lwjgl.fmod.FMODException;
import org.lwjgl.fmod.FSound;
import org.lwjgl.fmod.FSoundStream;


/* Static imports.
 */


import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.glu.GLU.*;

import static org.lwjgl.fmod.FMOD.*;
import static org.lwjgl.fmod.FSound.*;

public abstract class LWJGL {


        /** Is game finished ? **/
      protected boolean finished;
     
        /** Parameters **/
      protected boolean fullscreen;
      protected String title;

      /** Lwjgl constructor.
       */


      public LWJGL(String title, boolean fullscreen)
      {
            this.title = title;
            this.fullscreen = fullscreen;
            createWindow();
            this.title = "constructor";
      }

      protected void createWindow()
      {
            try
            {
                  if (fullscreen)
                  {
                        int mode = -1;
                        DisplayMode modes[] = Display.getAvailableDisplayModes();
     
                        for(int i = 0; i < modes.length; i++)
                        {
                              if(modes[i].width == 1024
                                 && modes[i].height == 768
                                 && modes[i].bpp >= 32)
                              {
                                    mode = i;
                                    break;
                              }
                        }
     
                        if(mode != -1)
                        {
                              System.out.println("Setting display mode to " + modes[mode]);
                              Display.setDisplayMode(modes[mode]);
                        }
                        Window.create(title, 32, 0, 0, 0);
                  }
                  else
                        Window.create(title, 0, 0, 800, 600, 32, 0, 8, 0);
            }
            catch(Exception e)
            {
                  System.err.println("Failed to create display/OpenGL mode due to " + e);
                  System.exit(1);
            }
      }


      /** Start OpenGL application.
       */

     
      protected void start()
      {
            title = "start()";
            try
            {
                  init();

                  while(!finished)
                  {
                        if(Window.isCloseRequested())
                              System.exit(0);

                        process_keyboard();
                        render();
                        Window.update();
                  }  
            }
            catch(Throwable t)
            {
                  t.printStackTrace();
            }
            finally
            {
                  cleanup();
            }
      }



      /** Init OpenGL and FMOD.
       */


      protected void init() throws Exception
      {
            title = "init()";
            loadTextures();
            initGL();
            initFMOD();
      }
 
       protected void loadTextures() {}
 
      protected void initGL() throws Exception
      {
              // Enable keyboard buffer.
           Keyboard.enableBuffer();

        glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
       glShadeModel(GL_SMOOTH); // Enable Smooth Shading
       glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background  
       glClearDepth(1.0f); // Depth Buffer Setup
       glEnable(GL_DEPTH_TEST); // Enables Depth Testing
       glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do

              // Go into 3D projection mode.
           glMatrixMode(GL_PROJECTION);
            glLoadIdentity();
            gluPerspective(45.0f, (float)Display.getWidth() / (float)Display.getHeight(), 1.0f, 200.0f);
            glMatrixMode(GL_MODELVIEW);
            glLoadIdentity();
            glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //Background color (r,g,b,alpha)
     }

      protected void initFMOD() {}

      /** Rendering method.
       */


      abstract void render();


      /** Process keyboard events.
       */


      protected void process_keyboard()
      {
            for(int i = 0; i < Keyboard.getNumKeyboardEvents(); i++)
            {
                  Keyboard.next();

                  if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState())
                        finished = true;
                       
                  if(Keyboard.getEventKey() == Keyboard.KEY_F1 && Keyboard.getEventKeyState())
                  {
                        Window.destroy();
                        fullscreen = !fullscreen;
                        createWindow();
                        loadTextures();
                        try
                        {
                              initGL();
                        }
                        catch (Throwable t)
                        {
                              t.printStackTrace();
                              System.exit(0);
                        }
                  }
            }
      }
 


      /** Cleanup.
       */


      protected void cleanup()
      {
            Keyboard.destroy();
            Window.destroy();

            cleanupFMOD();

            try
            {
                  Display.resetDisplayMode();
            }
            catch(Exception e)
            {
                  e.printStackTrace();
            }
      }
     
      protected void cleanupFMOD() {}
}
27  Java Game APIs & Engines / OpenGL Development / Re: Textures overlap on: 2004-07-09 12:28:54
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  
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;

import static org.lwjgl.opengl.GL11.*;

public class Texture
{

      /**
       * Texture loading directly from LWJGL examples
       */

      public static final int[] loadTexture(String[] paths) {
            int[] texs = new int[paths.length];
            for (int i=0; i<paths.length; i++)
            {
                  Image image = (new javax.swing.ImageIcon(paths[i])).getImage();
     
                  // Exctract The Image
                 BufferedImage tex = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_3BYTE_BGR);
                  Graphics2D g = (Graphics2D) tex.getGraphics();
                  g.drawImage(image, null, null);
                  g.dispose();
     
                  // Flip Image
                 AffineTransform tx = AffineTransform.getScaleInstance(1, -1);
                  tx.translate(0, -image.getHeight(null));
                  AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
                  tex = op.filter(tex, null);
     
                  // Put Image In Memory
                 ByteBuffer scratch = ByteBuffer.allocateDirect(4 * tex.getWidth() * tex.getHeight());
     
                  byte data[] = (byte[]) tex.getRaster().getDataElements(0, 0, tex.getWidth(), tex.getHeight(), null);
                  scratch.clear();
                  scratch.put(data);
                  scratch.rewind();
     
                  // Create A IntBuffer For Image Address In Memory  
                 IntBuffer buf = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
                  glGenTextures(buf); // Create Texture In OpenGL  
     
                  glBindTexture(GL_TEXTURE_2D, buf.get(0));
                  // Typical Texture Generation Using Data From The Image
     
                  // Linear Filtering
                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
                  // Linear Filtering
                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
                  // Generate The Texture
                 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, tex.getWidth(), tex.getHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, scratch);
     
                  texs[i]= buf.get(0); // Return Image Address In Memory
           }
            return texs;
      }
}
28  Java Game APIs & Engines / OpenGL Development / Re: NT4 Problems on: 2004-07-08 08:17:14
Thanks you guys for your insight and help! Appreciate it!
29  Java Game APIs & Engines / OpenGL Development / NT4 Problems on: 2004-07-07 11:38:44
Herkules has informed me that the following code generates (on NT4) this error message:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
ava.lang.IllegalStateException: Keyboard must be created before you can enable buffering
      at org.lwjgl.input.Keyboard.enableBuffer(Unknown Source)
      at LWJGL.initGL(LWJGL.java:129)
      at LWJGL.init(LWJGL.java:122)
      at LWJGL.start(LWJGL.java:93)
      at BasicGame.main(BasicGame.java:56)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.sun.javaws.Launcher.executeApplication(Unknown Source)
      at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
      at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
      at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
      at com.sun.javaws.Launcher.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)


There's no error message on my winxp system

Here's my 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  
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.glu.GLU.*;

public final class BasicGame extends LWJGL
{

    /** Some stuff I added for fun **/
      private float translation=0.0f;
      private float velocity=0.02f;
      private float rot=0;
      
      /** Lwjgl constructor.
       */


      public BasicGame()
      {
            super("BasicGame", false);
      }




      /** Rendering method.
       */


      protected final void render()
      {
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
            glLoadIdentity();

              // Draw here...
           glTranslatef(-1.5f,0.0f,-6.0f);                              // Move Left 1.5 Units And Into The Screen 6.0

            glRotatef(rot,1.0f,1.0f,0.0f);      
            glBegin(GL_QUADS);                                    // Drawing Using Triangles
                 glColor3f(1.0f,0.0f,0.0f);
                  glVertex3f( 0.0f+translation, 1.0f, 0.0f);                        // Top
                 glColor3f(0.0f,1.0f,0.0f);
                  glVertex3f(-1.0f+translation,-1.0f, 0.0f);                        // Bottom Left
                 glColor3f(0.0f,0.0f,1.0f);
                  glVertex3f( 1.0f+translation,-1.0f, 0.0f);                        // Bottom Right
                 glColor3f(1.0f,1.0f,1.0f);
                  glVertex3f( 1.0f+translation,0.0f, 1.0f);
            glEnd();
            rot+=3.0f;
            translation+=velocity;
            if (translation < 0.0f || translation > 3.0f)
                  velocity=-velocity;
      }

      /** Main method.
       */


      public static void main(String args[])
      {
            (new BasicGame()).start();
      }
}


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  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
/* Standard imports.
 */


import org.lwjgl.*;
import org.lwjgl.input.*;
import org.lwjgl.opengl.*;

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;

import org.lwjgl.fmod.FMOD;
import org.lwjgl.fmod.FMODException;
import org.lwjgl.fmod.FSound;
import org.lwjgl.fmod.FSoundStream;


/* Static imports.
 */


import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.glu.GLU.*;

import static org.lwjgl.fmod.FMOD.*;
import static org.lwjgl.fmod.FSound.*;

public abstract class LWJGL {


        /** Is game finished ? **/
      protected boolean finished;
      
        /** Parameters **/
      protected boolean fullscreen;
      protected String title;

      /** Lwjgl constructor.
       */


      public LWJGL(String title, boolean fullscreen)
      {
            this.title = title;
            this.fullscreen = fullscreen;
            createWindow();
      }

      protected void createWindow()
      {
            try
            {
                  if (fullscreen)
                  {
                        int mode = -1;
                        DisplayMode modes[] = Display.getAvailableDisplayModes();
      
                        for(int i = 0; i < modes.length; i++)
                        {
                              if(modes[i].width == 1024
                                 && modes[i].height == 768
                                 && modes[i].bpp >= 32)
                              {
                                    mode = i;
                                    break;
                              }
                        }
      
                        if(mode != -1)
                        {
                              System.out.println("Setting display mode to " + modes[mode]);
                              Display.setDisplayMode(modes[mode]);
                        }
                        Window.create(title, 32, 0, 0, 0);
                  }
                  else
                        Window.create(title, 0, 0, 800, 600, 32, 0, 8, 0);
            }
            catch(Exception e)
            {
                  System.err.println("Failed to create display/OpenGL mode due to " + e);
                  System.exit(1);
            }
      }


      /** Start OpenGL application.
       */

      
      protected void start()
      {
            try
            {
                  init();

                  while(!finished)
                  {
                        if(Window.isCloseRequested())
                              System.exit(0);

                        process_keyboard();
                        render();
                        Window.update();
                  }  
            }
            catch(Throwable t)
            {
                  t.printStackTrace();
            }
            finally
            {
                  cleanup();
            }
      }



      /** Init OpenGL and FMOD.
       */


      protected void init() throws Exception
      {
            initGL();
            initFMOD();
      }
 
      protected void initGL() throws Exception
      {
              // Enable keyboard buffer.
           Keyboard.enableBuffer();

              // Go into 3D projection mode.
           glMatrixMode(GL_PROJECTION);
            glLoadIdentity();
            gluPerspective(45.0f, (float)Display.getWidth() / (float)Display.getHeight(), 1.0f, 200.0f);
            glMatrixMode(GL_MODELVIEW);
            glLoadIdentity();
            glClearColor(0.0f, 0.0f, 0.0f, 0.0f); //Background color (r,g,b,alpha)
     }

      protected void initFMOD() {}

      /** Rendering method.
       */


      abstract void render();


      /** Process keyboard events.
       */


      protected void process_keyboard()
      {
            for(int i = 0; i < Keyboard.getNumKeyboardEvents(); i++)
            {
                  Keyboard.next();

                  if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState())
                        finished = true;
                        
                  if(Keyboard.getEventKey() == Keyboard.KEY_F1 && Keyboard.getEventKeyState())
                  {
                        Window.destroy();
                        fullscreen = !fullscreen;
                        createWindow();
                        try
                        {
                              initGL();
                        }
                        catch (Throwable t)
                        {
                              t.printStackTrace();
                              System.exit(0);
                        }
                  }
            }
      }
 


      /** Cleanup.
       */


      protected void cleanup()
      {
            Keyboard.destroy();
            Window.destroy();

            cleanupFMOD();

            try
            {
                  Display.resetDisplayMode();
            }
            catch(Exception e)
            {
                  e.printStackTrace();
            }
      }
      
      protected void cleanupFMOD() {}
}


Does anyone no what the problem and maybe how to solve it?

It can be found as a web start app at www.projektrandom.frac.dk
30  Game Development / Newbie & Debugging Questions / Re: Simple web start on: 2004-07-07 08:54:39
Just tested it with Netscape 7.1 and it worked fine. By surfing through forums round the net I'm now convinced that my server isn't set up to make web start and IE cooperate. This is due to a bug in IE caching - damn you MS!!
Thanks for your help!
Pages: [1] 2
 

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

The first screenshot will be displayed as a thumbnail.

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

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

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

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

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

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

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

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

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

ctomni231 (59 views)
2014-07-18 06:55:21
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!