Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (622)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (674)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: 1 2 [3] 4 5
  ignore  |  Print  
  How to: Getting started with JOGL  (Read 161384 times)
0 Members and 2 Guests are viewing this topic.
Offline kaffiene
« Reply #60 - Posted 2006-07-18 00:52:58 »

Thanks Ken  Smiley
Offline tiger7

Innocent Bystander

« Reply #61 - Posted 2007-02-12 13:29:27 »


Can anyone say why my app(one of the lastest jogl and jdk6, WinXP SP2)  has these problems?
1. After going fullscreen the bottom part of the screen(START button line) is under the "start" button.
2. Before pressing alt-tab it draws a twice slimer line at the top of the screen, but after alt-tab this problem and the first problem  will be solved.

import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.event.*;
import javax.swing.JFrame;

public class Test
  extends JFrame
    implements GLEventListener, KeyListener
  private GLCapabilities caps;
  private GLCanvas canvas;

  GLAutoDrawable drawable;
  int x = 50;
  public Test()

    caps = new GLCapabilities();
    canvas = new GLCanvas(caps);

  public void run()

   GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();

  public static void main(String[] args)
    new Test().run();

  public void init(GLAutoDrawable drawable)
    GL gl = drawable.getGL();
    this.drawable = drawable;
    float values[] = new float[2];
    gl.glGetFloatv(GL.GL_LINE_WIDTH_GRANULARITY, values, 0);
    gl.glGetFloatv(GL.GL_LINE_WIDTH_RANGE, values, 0);
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
  public void display(GLAutoDrawable drawable)
   GL gl = drawable.getGL();
    gl.glColor3f(0.0f, 1.0f, 0.0f);
  private void drawBlocksAndBorder(GLAutoDrawable drawable)
    GL gl = drawable.getGL();

    gl.glBegin(gl.GL_QUADS);                  // Draw A Quad
    gl.glVertex3f( getCoordX(0), getCoordY(0), 0.0f);            // Top Left
    gl.glVertex3f( getCoordX(800), getCoordY(0), 0.0f);            // Top Right
    gl.glVertex3f( getCoordX(800), getCoordY(25), 0.0f);            // Bottom Right
    gl.glVertex3f( getCoordX(0), getCoordY(25), 0.0f);            // Bottom Left

  public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h)

  public void displayChanged(GLAutoDrawable drawable, boolean modeChanged,
      boolean deviceChanged)

  public void keyTyped(KeyEvent key)

  public void keyPressed(KeyEvent key)

  public void keyReleased(KeyEvent key)
  public float getCoordX(float x)
        return -(640-x*1.6f)/640;
     else if(x>640)
        return (-640+x*1.6f)/640;
          return 0;

  public float getCoordY(float y)
        return (512-y*1.7066f)/512;
     else if(y>512)
        return -(-512+y*1.7066f)/512;
          return 0;
Offline Ken Russell

JGO Coder

Java games rock!

« Reply #62 - Posted 2007-02-12 16:34:46 »

The call to setLocationRelativeTo() is messing things up. Take it out and things should work fine.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Humunculus

Senior Newbie

« Reply #63 - Posted 2007-02-20 17:32:55 »

Ok guys, hey there, n00b talking.

I am sure this issue has been addressed like a million  times (and i see some far more serious questions aroud this thread)  but i'll risk asking here.
I have problems on setting JOGL.

I have winXP-32, JDK and JRE 1.6.0 installed and net beans 5.5
I have added my jdk bin path (normaly c:\program files\java\jdk1.6.0\bin) to the windows path.
I am now trying to set up jogl.

So i got


copied in my bin folder and jogl.jar in lib/ext folder.
Now correct if i am wrong. at first i put them in the jre1.6.0 folders calles so, meaning:
..\jre1.6.0\bin       &

That didn't work for me, i got a compile time error:                         package does not exist

I tried copying the files to other location like
..\jdk1.6.0\jre\bin     &
and even ..\jdk1.6.0\bin for the .dll(s) (just in case)

my "java.library.path" gives :
C:\Program Files\Java\jdk1.6.0\jre\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Python24\.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\Java\jdk1.6.0\jre\bin

Oh i also tried to add the jogl.jar to the project in net beans as described in the help file : Working with Projects-->Standard Projects-->Managing the classpath.... nothing....

I know it must be something stupid that i do wrong or sth.... so plz can someone tell me.....what does this n00b do wrong?

Thank you in advance.
Offline cylab

JGO Wizard

Medals: 90

« Reply #64 - Posted 2007-02-20 17:45:17 »

First remove every file related to jogl/gluegen jars and dlls you have spread across your system. Especially don't _ever_ install jogl to global locations such as jre\lib or c:\windows.

Since you are using netbeans, just use my module:

Note: If you already created a JOGL library inside Netbeans using |Tools| -> |Library Manager|, make sure to delete it prior to the module installation.

package does not exist
I assume you are trying to compile examples from other sites. "" is outdated and was replaced by ""

Mathias - I Know What [you] Did Last Summer!
Offline Humunculus

Senior Newbie

« Reply #65 - Posted 2007-02-20 18:06:02 »

great! thanks! i'll try it out asap and let ypu know if anything comes up.
thx a lot. question though. is there a setting without using the module you linked? just asking out of curiosity.

(PS here, i found in many sites (outdated maybe) that i had to install the files in lib/ext and bin. Why is it that this is bad?)

thanks again
Offline cylab

JGO Wizard

Medals: 90

« Reply #66 - Posted 2007-02-20 19:29:03 » question though. is there a setting without using the module you linked? just asking out of curiosity.
Yes there is.
- Downloaded the JOGL distribution for your platform (e.g. "")
- Unzip it into a local folder (e.g. "C:\development\javalibs\")
- Start Netbeans, go to |Tools| -> |Library Manager|
- Click [New Library] and create a "Class Library" named "JOGL-DEPS" (don't call it JOGL, since this breaks my module Wink)
- Click [Add Jar/Folder] and select "jogl.jar" and "gluegen-rt.jar" from the "lib" directory of the unzipped JOGL distribution
- Close the Library Mananger using [OK]
- Create a "Java Application" from Netbeans "General" project templates
- Go to the "Libraries" node of the new project and right click "Add"
- Select "JOGL-DEPS" and close the dialog
- Open the project properties
- Go to the "run" node and add "-Djava.library.path=C:/development/javalibs/jogl-1.1.0-rc3-windows-i586/lib" to the VM options

That should be it. My module adds the ability to build distributions of your app and comes with a out of the box running example app.

(PS here, i found in many sites (outdated maybe) that i had to install the files in lib/ext and bin. Why is it that this is bad?)
It breaks Java Webstart deployment of JOGL apps, since the locally installed version has precedence over the one in the Webstart descriptor, so if the webstarted App needs a different version, it doesn't run and you will have no clue, why...

Mathias - I Know What [you] Did Last Summer!
Offline Humunculus

Senior Newbie

« Reply #67 - Posted 2007-02-20 19:47:43 »

Enlightening! Thanks a lot mate!
Offline Humunculus

Senior Newbie

« Reply #68 - Posted 2007-02-21 17:04:23 »

I have another probablly stupid question.

When i try to

import    com.sun.opengl.utils.Animator;

i get a 'package does not exist' error during compile. Net beans indicate also that i have not  Javadoc documentetion or haven't added specified javadoc in my java platform manager.

should i get some specific javadoc, or .jar file and install or is it something else? Maybe it is also outdated? in fact i am really confused as of where to get correct examples of code that works.

Sorry for being so inadequate in this, i just moved here from C, things were clearer to me there  Embarrassed
I am really trying to get a going here  Undecided

thanks for any help.
Offline cylab

JGO Wizard

Medals: 90

« Reply #69 - Posted 2007-02-21 17:17:34 »

When i try to
import    com.sun.opengl.utils.Animator;

Just remove the unknow import, place your cursor over a the read underlined usage of Animator in your code, wait for a yellow "light bulb" to apear on the left side of the editor, click on it and select "import ....Animator". The IDE does the rest.

Use this "technique" with outdated examples as well. Just remove the imports, search for red underlined class usages and let the imports be fixed by the IDE.

in fact i am really confused as of where to get correct examples of code that works.

There are quite a lot of working examples in the jogl-demos distribution on the jogl-files page:

Mathias - I Know What [you] Did Last Summer!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Humunculus

Senior Newbie

« Reply #70 - Posted 2007-02-21 19:46:41 »

again you save me. I hope i will ask more content questions in the future if need be.
thanks a lot for bith patience and advice.

P.S. I must be blind to not see those zip files ....god.....
Offline Humunculus

Senior Newbie

« Reply #71 - Posted 2007-02-22 11:45:40 »

Okey,thanks to your advice and some more searching for an example as simple as it comes i think i am finally getting closer to actually running something in jogl...yay  Embarrassed
anyway, i still got a problem, hopefully the final one before going deeper into this stuff.

i got an example that creates a very basic JOGL GLEventListener.
It compiles with no errors (thx again), but i go tthis run time error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path

I tried to correct this by adding:       -Djava.library.path=C:\Program Files\javalib\jogl-1_0_0-windows-i586\lib
in the run tab of the project at VM options.

yet i get another error:   

java.lang.NoClassDefFoundError: Files\javalib\jogl-1_0_0-windows-i586\lib

only this time i got no idea how to fix it.  Undecided

Also i am following the Java tutorials at     in order to a grip of what's goin on around java  but i could use more that this (for example a good explanation on madules packets javadocs and stuff). 

Thanks again in advance for any help.

Offline cylab

JGO Wizard

Medals: 90

« Reply #72 - Posted 2007-02-22 12:41:09 »

- with java, always use forward slashes, even on windows
- theres a space in your path, so you have to quote the string
-Djava.library.path="c:/Program Files/javalib/jogl-1_0_0-windows-i586/lib"

Mathias - I Know What [you] Did Last Summer!
Offline Humunculus

Senior Newbie

« Reply #73 - Posted 2007-02-22 13:39:55 »

thanks again. it seems to work with no problem using both   " / "  or   " \ ".
Offline kylix999

Junior Devvie

« Reply #74 - Posted 2007-04-14 19:43:47 »


do you know some prog or anything that will make more simple running jogl prog, i know i can use bat file with -cp option but i was thinking is it posiible to make it more easier for end user who do not have any knowledge what classpath is etc

for example i would like to make it as simple like is eclipse made, you know estract downloaded zip and normally click eclipse etc
with normal java progs in jar without external libraries it is easy just 2xClick jar and it works but with jogl... it will not
i was thinking also is it possible to use jnlp file just locally  but i do not have such experience with it Undecided

for example now i am using such bat code:
java -jar M3G_MAKER.jar -cp "c:\jogl.jar;."

the problem is that manualy user must ceate jogl folder and than copy jogl files to it so when he clicks bat file prog will work
but how to make it simple?
for example lets imagine some directory where my prog jar is:


so main is progdirectory , lib , data are subdirectoiries of progDirectory and lets imagine that jogl must be in that lib directory and
and progDirectory can be anywhere on hdd...
you know what i mean? Grin

so how to make my prog not on fixed lib jogl directory dependent?

any ideas?

« Reply #75 - Posted 2007-04-17 13:18:53 »

You can use the following tree :

with the following M3G_MAKER.bat :

@echo off
cd system
java -Djava.library.path=lib -cp gluegen-rt.jar;jogl.jar;M3G_MAKER.jar  -Dsun.java2d.noddraw=true M3G_MAKER.Main
Offline hell32.dll

Senior Newbie

« Reply #76 - Posted 2007-05-31 07:22:33 »

that's all good but after installing librarys my IntelliJIDEA do that:


but i'm need to import not from javax, i'm need do implements library from net... like in exaples Angry
and import; is not avalible

because if i'm implements from javax then someone funcs is not avalible...for example : drawable.getGL()

Sorry i'm bad speak English =)
Offline jboyd99

Junior Newbie

« Reply #77 - Posted 2007-06-01 16:49:34 »

This is a desperate plea. I have a VERY SIMPLE request:

Please pin a topic explaining the options and caveats for deploying JOGL apps. Failing that, please respond as to why this won't happen. It would be greatly appreciated by many people.

The more detailed issue follows. Note how I'm giving a pretty good outline of the proposed HOWTO, sans the definitive answers...

Having searched around high and low, I have seen many explanations as to how to deploy JOGL apps. The majority consensus seems to be to use Java Web Start. In some places I've seen it recommended that the JOGL libraries (both JAR files and platform-specific native pieces) be added to the JRE's standard extension directory; in other places I have seen dire warnings not to do this (with sketchy explanations given as to why not). The latter recommend either JWS or setting the system-wide CLASSPATH and platform-specific library path environment variables. I have also seen mention of a method to use JOGL in applets, but have not yet tried to do this myself.

Here are some problems with these suggestions:

1. In many situations, Java Web Start is not desirable. To name a few: you have a ginormous app you want to distribute on a CD or other media that uses JOGL; you want users to be able to run the app as a locally installed, offline application, since it has nothing to do with the internet; you are really lazy and don't want to investigate the poorly documented JWS setup and write a big XML file; you don't have access to a static web server host; you are using JOGL in an app containing other libraries that can not be deployed this way. I think I've made my point on this.

2. Setting the CLASSPATH and PATH does not appear to work. At least didn't work for me. (JOGL 1.1.0, JRE 1.5.0_9, Windows XP) I cannot for the life of me think why it wouldn't work, but it does not. I tried rebooting; nothing. I set both these variables to the location containing all the JOGL libraries (JARs and .DLLs). As I've seen documented. When I try to execute my simple JOGL app, either by double-clicking the JAR file or doing java -jar testapp.jar from the command line, I get an error. (In double-click case this error erroneously tells me that main class could not be found; by putting JOGL libraries into the JRE's extension directory, the app runs just fine, indicating that in fact the main class is easy to find, and is specified correctly in the jar manifest, but this would seem to be a JRE issue.)

3. I can run by test app by giving a full java -classpath ".;%CLASSPATH%;C:\jogl\jogl.jar;C:\jogl\gluegen.jar" -jar testapp.jar . However this is a pain in the ass, and the whole point here is I am trying to allow end users to run this app. For that matter, even setting the system-wide CLASSPATH and PATH variables (or LD_LIBRARY_PATH on Linux, whatever it is on OS X) is not something users are going to do for the most part. (For development its also simple to let my IDE add the JARs to the build path and test within the IDE.)

3. Because of 1,2, and 3, I appear to be left with no options but to copy the JOGL libraries into my JRE's lib/ext directory. Though this is discouraged with dire warnings, it works just fine for me so far. As for these dire warnings, I do understand that this method will break whenever the JRE is updated to another version (again, a JRE issue; IMHO it ought to be smart enough to keep already installed extensions when updating, or allow users to choose this option). I have also been warned that this causes a conflict when other apps using Java Web Start but using a different (or even same?) version of JOGL are loaded. So that's no good...

4. When I've tried to have a couple friends test my app, they have had failures I cannot explain. One, also using Windows XP, was unable to get the app to run correctly when double-clicking even after placing the JOGL libraries in the JRE's extension directory. She was able to run from the command-line though, doing java -jar testapp.jar, with the libraries in the extension dir. This mystifies me, as I am able to double-click the jar file. Another friend on OS X who out of paranoia has so far refused to place the libraries into the extension dir has had errors even when invoking from the command-line with the full classpath to the libraries specified, that he solved only by moving to the same directory as my app before invoking. The point is, it has been a pain in the ass to tell other users how to run the app.

5. So based on these points, it appears there is *no* reliable way to run JOGL apps, other than Java Web Start (see point #1). Correct me if I'm wrong, but isn't deploying an app likely to be something *all* developers will want to do at some point? It seems there ought to be a simple way to allow users to have the same experience with a Java app (3D or otherwise) as with any other application. I am not averse to using an installer package like InstallAnywhere, or even writing my own batch and shell files for different target platforms so users can double-click something, but as this post details, I'm not sure where the JOGL stuff ought to be installed or what those scripts ought to contain.

I hope the detail here is helpful and not aggravating and that it is appreciated that the need for solid answers to these issues in a highly visible place is important to all potential JOGL users and developers. If such a resource exists, by all means point me to it and I will apologize for being redundant (but please pin it on these forums).


Jason Boyd


Offline cylab

JGO Wizard

Medals: 90

« Reply #78 - Posted 2007-06-02 01:50:07 »

The is outdated and deprecated. Use the package. For examples try to work throught the jogl-demos, they are all reworked for the new api. Maybe see this thread for more information.

Placing the jogl jars in the jre/ext directory is dangerous because of webstart conflicts with other jogl apps. I even consider this a non-option from the end-user perspective, too. Just create a directory tree like Agrv2236 suggested (note that M3G_MAKER has to be substituted with <your application>), include the desired jogl-version in the package and use a bat or cmd-file to start. Another option would be to write an installer-script (innosetup or something) that creates a desktop/startmenu shortcut for starting the app. If you ship on cd, also packaging a JRE would be the safest thing to do.

One, also using Windows XP, was unable to get the app to run correctly when double-clicking even after placing the JOGL libraries in the JRE's extension directory. She was able to run from the command-line though, doing java -jar testapp.jar, with the libraries in the extension dir.

Maybe your friend installed some software (like WinZIP, Nokia application installer etc.), that registers itself for the jar file type. This is a long standing problem with executable jars in general :/

Mathias - I Know What [you] Did Last Summer!
Offline kfaissal

Junior Newbie

« Reply #79 - Posted 2007-06-28 20:12:58 »

We are developing a large scale traffic simulator for research purposes. We are using java/JOGL in Windows environment.

We are in the process of buying a new workstation for our lab. Is it a right decision to go with intel 64 bit quad core processor with Windows Vista? Would we expect any problems running JOGL on such platform?

What JOGL binaries should we use? if any?
Offline skooter

Junior Newbie

« Reply #80 - Posted 2007-07-03 04:40:56 »

First of all - GREAT tutorial/updates. I've just finished a course on OpenGL for ANSI-C and this changeover is brill...

kfaissal - I'm running a dual-core intel 32bit with Vista and JoGL works fine! Chews up a hellavalot of processing tho' (just for a simple triangle) using jogl-1.1.1-rc1-windows-i586 bins (I'm assuming those are old - although I only downloaded them a few months ago). Make sure you use* tho'. Having said that I've got all the dlls and jars installed in my jre, which I understand may cause clashed for you. Good luck figuring that out!

Offline cylab

JGO Wizard

Medals: 90

« Reply #81 - Posted 2007-07-03 17:14:52 »

kfaissal - I'm running a dual-core intel 32bit with Vista and JoGL works fine! Chews up a hellavalot of processing tho' (just for a simple triangle) using

Looks like it is falling back to software rendering. There are some issues on Vista but imho all related to drivers.

Mathias - I Know What [you] Did Last Summer!
Offline ekjo014

Junior Newbie

« Reply #82 - Posted 2007-08-25 06:37:13 »

I have written a more up to date tutorial. introducing basically the same concepts.
Offline cylab

JGO Wizard

Medals: 90

« Reply #83 - Posted 2007-08-25 18:16:40 »

While your tutorial is good, both links you supply for installing JOGL suggest to copy the jogl.jar to the lib/ext directory, which is strongly discouraged, since it breaks webstart installation. This can lead to downloaded applications not working on the machine! Just copy the jogl jars somewhere on your system (e.g. C:\development\jogl) and set the CLASSPATH and PATH (LD_LIBRARY_PATH on Linux) variables accordingly.

Mathias - I Know What [you] Did Last Summer!
Offline ekjo014

Junior Newbie

« Reply #84 - Posted 2007-08-25 18:50:00 »

yes that is true. my tute is meant mainnly for n00bs, and the installation section is included only as a courtesy
Offline cylab

JGO Wizard

Medals: 90

« Reply #85 - Posted 2007-08-26 21:02:18 »

yes, I do understand that, but especially noobs would have problems debugging this situation, if they try to run a webstart app depending on a different jogl version.

Mathias - I Know What [you] Did Last Summer!
Offline ekjo014

Junior Newbie

« Reply #86 - Posted 2007-08-27 03:57:44 »

yeah true. i'll update when i get the chance.
Offline capowski

Junior Newbie

« Reply #87 - Posted 2008-03-20 21:44:03 »

I struggled to get JOGL running correctly as many above people describe.  But Netbeans saved me.  If you use
the NetBeans IDE version 6.0 or later, it comes with the openGL pack, and all that JOGL stuff is done for you.
You don't even have to know what the word "classpath" means.  In addition, NetBeans provides a dozen openGL
examples, and provides them in the best possible way, i.e., as a project in the IDE that you can select.  It makes
it so easy to learn, because, for example, you can select the openGL gears demo, run it, modify it, run it again, etc.
Kudos to netbeans!

I'm struggling now with the same thing that Jason Boyd described, how to deploy a Java-openGL project on the
internet.  I have deployed many applets, but cannot figure out how to write an applet that uses openGL.  I have written
many openGL applications, but haven't been able to deploy any of them successfully.  Does anyone know of a
tutorial or examples that allows us to put an Java-openGL program (either applet or application) on the web so that
someone else can run it as they now can run a Java applet (without openGL)?
Offline Ricardo-san

Innocent Bystander

« Reply #88 - Posted 2008-03-22 23:19:09 »

Hey people. I just downloaded the JOGL files to my HD. So, all I have to do is include the .jar in  my app? I don't have admin access on my computer so I can't install applications... Cry
Offline cylab

JGO Wizard

Medals: 90

« Reply #89 - Posted 2008-03-23 12:50:13 »

For compiling JOGL based apps, you need to specify the needed jars on
the classpath:

javac -classpath path/to/jogl.jar:path/to/gluegen-rt.jar
       -sourcepath app/sources -d app/classes

and run it via

java -Djava.library.path=path/to/jogl/natives:path/to/gluegen/natives
      -classpath path/to/jogl.jar:path/to/gluegen-rt.jar:app/classes

Replace : with ; when using windows.

You can put the above in a .sh(unix) or .bat(windows) file.

Mathias - I Know What [you] Did Last Summer!
Pages: 1 2 [3] 4 5
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

basil_ (32 views)
2015-09-30 17:04:40

shadowstryker (16 views)
2015-09-29 15:55:06

TheSpaceHedgehog (22 views)
2015-09-29 01:58:48

GamerC4 (45 views)
2015-09-24 21:10:38

GamerC4 (65 views)
2015-09-24 21:09:48

htuy (21 views)
2015-09-24 04:57:24

htuy (30 views)
2015-09-24 04:56:35

htuy (20 views)
2015-09-24 04:56:09

htuy (21 views)
2015-09-24 04:47:33

Roquen (58 views)
2015-09-21 12:54:28
Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36 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‑
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!