Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
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 152730 times)
0 Members and 1 Guest 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 »

Hi.

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.

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 java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.event.*;
import javax.swing.JFrame;
import javax.media.opengl.*;

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

  GLAutoDrawable drawable;
  int x = 50;
 
  public Test()
  {
    super("Test");

    caps = new GLCapabilities();
    canvas = new GLCanvas(caps);
    canvas.addGLEventListener(this);
    canvas.addKeyListener(this);
 
    getContentPane().add(canvas);
  }

  public void run()
  {
   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   setUndecorated(true);

   GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
   gd.setFullScreenWindow(this);
   
   setVisible(true);
   setLocationRelativeTo(null);
    setVisible(true);
    canvas.requestFocusInWindow();
  }

  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.glEnable(GL.GL_LINE_SMOOTH);
    gl.glEnable(GL.GL_BLEND);
    gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
    gl.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_DONT_CARE);
    gl.glLineWidth(1.5f);
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
  }
 
  public void display(GLAutoDrawable drawable)
  {
   GL gl = drawable.getGL();
    gl.glClear(GL.GL_COLOR_BUFFER_BIT);
    gl.glColor3f(0.0f, 1.0f, 0.0f);
    gl.glPushMatrix();
   
    drawBlocksAndBorder(drawable);
   
    gl.glPopMatrix();
    gl.glFlush();
  }
 
  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
    gl.glEnd();

    gl.glFlush();  
 
  }
  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)
  {
     if(x<640)
     {
        return -(640-x*1.6f)/640;
     }
     else if(x>640)
     {
        return (-640+x*1.6f)/640;
     }
      else
       {
          return 0;
       }
   }
     

  public float getCoordY(float y)
  {
     if(y<512)
     {
        return (512-y*1.7066f)/512;
     }
     else if(y>512)
     {
        return -(-512+y*1.7066f)/512;
     }
      else
       {
          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

jogl.dll
jogl_cg.dll
jogl_awt.dll

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       &
..\jre1.6.0\lib\ext

That didn't work for me, i got a compile time error:                         package net.java.games.jogl does not exist

I tried copying the files to other location like
..\jdk1.6.0\jre\bin     &
..\jdk1.6.0\jre\lib\ext
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 Ninja


Medals: 55



« 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: http://www.java-gaming.org/forums/index.php?topic=12530.msg126787#msg126787

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

Quote
package net.java.games.jogl does not exist
I assume you are trying to compile examples from other sites. "net.java.games.jogl" is outdated and was replaced by "javax.media.opengl"

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.


....got 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 Ninja


Medals: 55



« Reply #66 - Posted 2007-02-20 19:29:03 »

....got 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. "jogl-1.1.0-rc3-windows-i586.zip")
- 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 Ninja


Medals: 55



« 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: https://jogl.dev.java.net/servlets/ProjectDocumentList?folderID=5971&expandFolder=5971

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 java.sun.com/docs/books/tutorial/     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 Ninja


Medals: 55



« 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
1  
-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 »

hi

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:
1  
2  
3  
java -jar M3G_MAKER.jar -cp "c:\jogl.jar;."
-Djava.library.path="c:\jogl"
-Dsun.java2d.noddraw=true


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:

progDiectory:
--------lib/jogl
--------data
--------M3G_MAKER.jar


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?

8: Undefined index: online
File: /home/jgo/public_html/Themes/default/Display.template.php (main sub template - eval?)
Line: 161