Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
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   
  Show Posts
Pages: [1]
1  Discussions / Community & Volunteer Projects / Re: Transport Tycoon goes Java on: 2007-10-20 12:43:29
Just a small question: is this project dead?
2  Java Game APIs & Engines / JOGL Development / Re: JSR-231 1.1.1 RC6 released on: 2007-10-20 12:42:21
Reason is found: I used the GNU Java Compiler and not Sun's. Angry

In Eclipse you have to do something more:

1) Create a new project (or use an existing
2) Add two new paths: lib and native
3) Download latest JOGL and extract it
4) Copy the *.jar files to lib, *.so|dll to native
5) Back in Eclipse hit the F5 key and expand the lib folder
6) Add both JARs to the build path (right-click them)

And now comes the important two steps:

7) Right-click your OpenGL project, choose Libraries and expand the JRE System Library part
Cool Click on Native library location, click Edit and chhose the native folder where you have copied the so/dlls to

Rebuild the project and you might be lucky... Wink Grin
3  Java Game APIs & Engines / JOGL Development / Re: JSR-231 1.1.1 RC6 released on: 2007-10-20 09:19:21
II got this error message with latest release:

Quote
Exception in thread "main" java.lang.IllegalArgumentException: GLDrawableFactory.chooseGraphicsConfiguration() was not used when creating this Component
   at com.sun.opengl.impl.x11.X11GLDrawableFactory.getGLDrawable(X11GLDrawableFactory.java:233)
   at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:117)
   at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:82)
   at javax.media.opengl.GLCanvas.<init>(GLCanvas.java:75)
   at Line.<init>(Line.java:24)
   at Line.main(Line.java:107)

Here is my little code (somewhere copied from this forum):

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  
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import javax.swing.*;

/**
 * @author quix0r
 *
 */

public class Line extends JFrame implements GLEventListener {

   /**
    *
    */

   private static final long serialVersionUID = -1445174150957788549L;
   /**
    *
    */

   public Line()
   {
      // the name of the window
     super("My First JOGL Application"); //$NON-NLS-1$

      // create the canvas we will be drawing on
     final GLCanvas canvas = new GLCanvas();

      // as this class implements the GLEventListener interface
     // it is what tells the canvas what to do.
     canvas.addGLEventListener( this ); // VERY IMPORTANT LINE

      // set the size of the canvas
     canvas.setSize(500, 300);

      // add the canvas to the window
     this.getContentPane().add(canvas);
   }
   /**
    *  This is the initialisation method. It is used to set up several of the
    *  state variables that are constant for the programs duration
    */

   public void init(final GLAutoDrawable drawable)
   {
      // the GL object is used to set the state variables
     final GL gl = drawable.getGL();

      // the GLU object can do alot of complex things
     // but there it is used to simply set up the coordinates
     // for the drawing area.
     final GLU glu = new GLU();

      // this sets the background colour to black
     // the first three numbers are the specification
     // of black in RGB, and the last is an alpha component.
     gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

      // sets the size of the viewable drawing area on the screen
     gl.glViewport(-500, -300, 500, 300);

      // dont worry too much about these
     gl.glMatrixMode(GL.GL_PROJECTION);
      gl.glLoadIdentity();

      // set the coordinate system. Its is set so that (0,0) is the centre of the canvas.
     // (-500, -300) is the bottom left corner.
     glu.gluOrtho2D(-500, 500.0, -300, 300.0);
   }
   /**
    * This method draws the red line that was mentioned in the tutorial
    * @param drawable
    */

   public void display(final GLAutoDrawable drawable)
   {
      // again we need the object representing the state of oplenGL
     final GL gl = drawable.getGL();

      // we earlier set the background colour, now we paint that
     // colour onto our canvas.
     gl.glClear(GL.GL_COLOR_BUFFER_BIT);

      // these are used to represent the RGB values for a colour
     // it isnt really necessary to use them in a program as simple as
     // this, but it is good practice.
     final float red = 1.0f;
      final float green = 0.0f;
      final float blue = 0.0f;

      // set the drawing colour to red.
     gl.glColor3f(red, green, blue);

      // set the width a line
     gl.glLineWidth(5.0f);

      // tell open gl to draw a line
     gl.glBegin(GL.GL_LINES);
         // from (-200, -200) to (200, 200)
        gl.glVertex2i(-200, -200);
         gl.glVertex2i(200, 200);
      gl.glEnd();
   }
   
   /*************************************************************
    * This has nothing to do with jogl, it is simply setting up the
    * window that the canvas will be inside.
    * @param argv
    */

   public static void main(final String[] argv)
   {
      final Line m = new Line();
      SwingUtilities.invokeLater
      (
         new Runnable()
         {
            public void run()
            {
               m.pack();
               m.setVisible(true);
            }
         }
      );
   }
   /* (non-Javadoc)
    * @see javax.media.opengl.GLEventListener#displayChanged(javax.media.opengl.GLAutoDrawable, boolean, boolean)
    */

   public void displayChanged(final GLAutoDrawable arg0, final boolean arg1, final boolean arg2) {
      // TODO Auto-generated method stub
     
   }
   /* (non-Javadoc)
    * @see javax.media.opengl.GLEventListener#reshape(javax.media.opengl.GLAutoDrawable, int, int, int, int)
    */

   public void reshape(final GLAutoDrawable arg0, final int arg1, final int arg2, final int arg3, final int arg4) {
      // TODO Auto-generated method stub
     
   }
}


Any idea?

Roland
Pages: [1]
 

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 (25 views)
2014-07-24 01:59:36

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

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

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

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

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

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

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

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

Riven (55 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!