Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (581)
Games in Android Showcase (162)
games submitted by our members
Games in WIP (632)
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  Java Game APIs & Engines / JOGL Development / Re: help! help! on: 2003-09-23 15:05:15
By the way, I tested all Mesa demos and they were fine.

2  Java Game APIs & Engines / JOGL Development / help! help! on: 2003-09-23 15:04:20
I upgraded my Mesa lib to Mesa-5.0.2 so that I could run Xith3D. Now  I can run it, but my jogl is suddenly broken!!! I got a lot of exceptions out of JVM in native lib. All the programs I run were functional before upgrade.

Please help!!!

3  Java Game APIs & Engines / JOGL Development / Re: Anyone working on the NeHe tutorials? on: 2003-09-15 21:01:43
Hi, Pepijnve,

Thanks a lot. There is one small glitch. You used Animator(canvas, 60), but I could not find such constructor for Animator in my JOGL lib. I think I am using the Sept. 5 release. After I changed it to Animator(canvas), it worked great. I tried lesson 11 and 14. It is great that you put commonlly used file in one folder.

I used C OpenGL before. It seems that this java stuff is much less portable than C!!! :-(

Thanks again. I had problem with every NEHE demo and was not targeting you. :-)

4  Java Game APIs & Engines / JOGL Development / Re: Anyone working on the NeHe tutorials? on: 2003-09-15 15:38:16

Thank you very much for letting me know the difference. I agree that the problem may be in jogl since all other parts of the code work well after using animator. Maybe somebody from JOGL developing team can answer the question.

Thanks again.

5  Java Game APIs & Engines / JOGL Development / Serious question about JOGL and NEHE tutorial on: 2003-09-15 14:13:10
Hi, JOGL gurus,

When I run your NEHE programs, I had a lot of exceptions out ot JVM as I stated in previous posts, for example Lesson 11.  Then in  Lesson 11 and Lesson 3, I had to create an Animator animator = new Animator(canvas), then use animator.start() to run it. I am using RH linux 7.2 and old hardware. Does anybody knows why??? Why was animator not used in the examples??? Any particular reasons? I want to find out the cause of the problems so that I do not have to change every program.

Actually, after I fixed Lesson 11, it runs better than the C code on my work station.  When I run C code, there is not much animation. But when I run jogl, it flys.

Thank you very much.

6  Java Game APIs & Engines / JOGL Development / Re: Anyone working on the NeHe tutorials? on: 2003-09-12 20:26:36
Hi, Sean,

Thanks for replying. Where and how did you change GLCapability in JOGL?

7  Java Game APIs & Engines / JOGL Development / Re: Anyone working on the NeHe tutorials?(GLUT_RGB on: 2003-09-12 19:42:37
I got this kind of errors for the most of the tutorials and reported one before. I am using RH linux 7.2 and not sure about graphic card and driver.

But I can run the c code from NEHE with some modification. For example, The lesson 11. I changed
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH) to without using GLUT_ALPHA), then the c code runs fine.


8  Java Game APIs & Engines / Java 3D / Xj3D loads .x3d to java? on: 2003-09-12 15:50:14

Has anybody done loading X3D into Java3D? I looked at Xj3D, but their examples only load vrml files.


9  Java Game APIs & Engines / JOGL Development / * T on: 2003-09-10 21:11:35
This might work.


* Created on Jul 7, 2003
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments

* @author w0zhang
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments

import java.awt.*;
import java.awt.event.*;


public class JoglTest
     implements GLEventListener, MouseListener, MouseMotionListener, KeyListener {

     private Frame frame;

     private Animator animator;

     private GLCanvas canvas;

     private float prevMouseX, prevMouseY;
     private float mouseX, mouseY;
     private float transX = 0f, transY = 0f, transZ = -10.0f;
     private boolean picked;
     private int pickedName;

     private float view_rotX_1 = 0.0f, view_rotY_1 = 0.0f, view_rotZ = 0.0f;
     private float view_rotX_2 = 0.0f, view_rotY_2 = 0.0f;
     private final int test = 1;

     private float fAspect;

     float lambr = 0.0f;
     float lambg = 0.0f;
     float lambb = 0.0f;
     float ldifr = 1.0f;
     float ldifg = 1.0f;
     float ldifb = 1.0f;
     float lsper = 1.0f;
     float lspeg = 1.0f;
     float lspeb = 1.0f;
     float lposx = 0.8f;
     float lposy = 0.8f;
     float lposz = 0.8f;

     float light_ambient[] = { lambr, lambg, lambb, 1.0f };
     float light_diffuse[] = { ldifr, ldifg, ldifb, 1.0f };
     float light_specular[] = { lsper, lspeg, lspeb, 1.0f };
     float light_position[] = { lposx, lposy, lposz };
     float global_ambient[] = { 0.75f, 0.75f, 0.75f, 1.0f };
     float mambr = 0.25f;
     float mambg = 0.2f;
     float mambb = 0.074f;
     float mdifr = 0.57f;
     float mdifg = 0.14f;
     float mdifb = 0.17f;
     float msper = 0.8f;
     float mspeg = 0.65f;
     float mspeb = 0.25f;
     float ambient[] = { mambr, mambg, mambb, 1.0f };
     float diffuse[] = { mdifr, mdifg, mdifb, 1.0f };
     float specular[] = { msper, mspeg, mspeb, 1.0f };
     float shininess = 20.0f;

     private JoglTest() {
           System.out.println("JoglTest instance created");

           // Canvas setup
           GLCapabilities caps = new GLCapabilities();
           canvas = GLDrawableFactory.getFactory().createGLCanvas(caps);

           canvas.setGL(new DebugGL(canvas.getGL()));

           // Frame setup
           frame = new Frame("Vectrix");
           frame.setSize(800, 600);

           frame.addWindowListener(new WindowAdapter() {
                 public void windowClosing(WindowEvent e) {

           // Event handlers
           animator = new Animator(canvas);

     public void initialiseDisplay() {

     public void run() {

     public static void main(String[] args) {
           System.out.println("Vectrix starting...");

           JoglTest app = new JoglTest();

           // Other loading/initialisation
           // ..

           // Start main game loop

     // GL Event Listener methods

     // Called when GL has been initialised for the first time.
     public void init(GLDrawable drawable) {
           System.out.println("Vectrix.init(): GL init event");

           GL gl = drawable.getGL();

           // light properties
           gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, light_ambient);
           gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, light_diffuse);
           gl.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, light_specular);
           gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, light_position);
           gl.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, global_ambient);
           // material properties
           gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT, ambient);
           gl.glMaterialfv(GL.GL_FRONT, GL.GL_DIFFUSE, diffuse);
           gl.glMaterialfv(GL.GL_FRONT, GL.GL_SPECULAR, specular);
           gl.glMaterialf(GL.GL_FRONT, GL.GL_SHININESS, shininess);

           // various OpenGL states



     public void display(GLDrawable drawable) {

           //System.err.println("DISPLAY THREAD: " + Thread.currentThread());

           if (picked)
                 processSelection(drawable, mouseX, mouseY);

     public void draw(GLDrawable drawable) {

           //System.err.println("DISPLAY THREAD: " + Thread.currentThread());
           GL gl = drawable.getGL();
           GLU glu = drawable.getGLU();

           gl.glClearColor(0.2f, 0.2f, 0.2f, 0.0f);
                       | GL.GL_DEPTH_BUFFER_BIT
                       | GL.GL_STENCIL_BUFFER_BIT);

           //gl.glColor3f(1f, 0f, 0f);
           float ambient[] = { 0.4f, 0.4f, 0.4f, 1.0f };
           gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT, ambient);

           GLUT glut = new GLUT();

           gl.glTranslatef(transX, transY, transZ);
           gl.glRotatef(view_rotX_1, 1.0f, 0.0f, 0.0f);
           gl.glRotatef(view_rotY_1, 0.0f, 1.0f, 0.0f);
           gl.glRotatef(view_rotZ, 0.0f, 0.0f, 1.0f);


           //gl.glTranslatef(0f, 0f, -3f);
           //gl.glRotatef(30f, 0f, 1f, 0f);
           glut.glutWireSphere(glu, 0.5, 100, 100);


           gl.glTranslatef(transX - 2, transY, transZ);
           gl.glRotatef(view_rotX_2, 1.0f, 0.0f, 0.0f);
           gl.glRotatef(view_rotY_2, 0.0f, 1.0f, 0.0f);
           gl.glRotatef(view_rotZ, 0.0f, 0.0f, 1.0f);


           //gl.glTranslatef(0f, 0f, -3f);
           //gl.glRotatef(30f, 0f, 1f, 0f);





     public void reshape(
           GLDrawable drawable,
           int x,
           int y,
           int width,
           int height) {
           //System.err.println("RESHAPE THREAD: " + Thread.currentThread());
           GL gl = drawable.getGL();
           GLU glu = drawable.getGLU();
           fAspect = (float) width / (float) height;

           //   l/r  b/t  near/far
           //gl.glOrtho(0, 4, 0, 3, -8, 8);

           glu.gluPerspective(30.0, (float) width / (float) height, 1.0, 50);
           //glu.gluLookAt(0.0, 0, 10, 0, 0, 0, 0, 1, 0);


     public void displayChanged(GLDrawable arg0, boolean arg1, boolean arg2) {

     public void processSelection(GLDrawable drawable, float x, float y) {
           GL gl = drawable.getGL();
           GLU glu = drawable.getGLU();
           int[] selectBuff = new int[64];
           int hits = 0;
           int[] viewport = new int[4];

           gl.glSelectBuffer(64, selectBuff);
           gl.glGetIntegerv(GL.GL_VIEWPORT, viewport);

           glu.gluPickMatrix(x, viewport[3] - y, 5, 5, viewport);
           glu.gluPerspective(30.0f, fAspect, 1.0, 50);
           hits = gl.glRenderMode(GL.GL_RENDER);
           if (hits > 0) {
                 int count = selectBuff[0];
                 pickedName = selectBuff[3];
                 System.out.println(count + " " + pickedName);

           } else {
                 System.out.println("no hit");
                 pickedName = 0;

           picked = false;


     public void processKey(KeyEvent event) {
           int key = event.getKeyCode();

           if (event.isControlDown() && key == KeyEvent.VK_DOWN) {
                 transY -= 0.1f;
           } else if (event.isControlDown() && key == KeyEvent.VK_UP) {
                 transY += 0.1f;
           } else if (key == KeyEvent.VK_DOWN) {
                 transZ += 0.1f;
           } else if (key == KeyEvent.VK_UP) {
                 transZ -= 0.1f;
           } else if (key == KeyEvent.VK_LEFT) {
                 transX -= 0.1f;
           } else if (key == KeyEvent.VK_RIGHT) {
                 transX += 0.1f;

     public void mouseEntered(MouseEvent e) {
     public void mouseExited(MouseEvent e) {

     public void mousePressed(MouseEvent e) {
           prevMouseX = e.getX();
           prevMouseY = e.getY();
           mouseX = e.getX();
                       mouseY = e.getY();
                       picked = true;

     public void mouseReleased(MouseEvent e) {
     public void mouseClicked(MouseEvent e) {


     public void mouseDragged(MouseEvent e) {
           int x = e.getX();
           int y = e.getY();

           Dimension size = e.getComponent().getSize();
           //System.out.println(size.width + " " + size.height);

           float thetaY = 360.0f * (float) (x - prevMouseX) / (float) size.width;
           float thetaX = 360.0f * (float) (prevMouseY - y) / (float) size.height;

           prevMouseX = x;
           prevMouseY = y;

                 case 1:
                       view_rotX_1 += thetaX;
                       view_rotY_1 += thetaY;
                 case 2:
                       view_rotX_2 += thetaX;
                       view_rotY_2 += thetaY;

     public void mouseMoved(MouseEvent e) {

     public void keyPressed(KeyEvent e) {

     public void keyReleased(KeyEvent e) {


     public void keyTyped(KeyEvent e) {

10  Java Game APIs & Engines / JOGL Development / Re: Anyone working on the NeHe tutorials? on: 2003-09-05 14:44:44

Thank you very much for your effort. It is very helpful for us to learn JOGL.

I run tutorial 2 and 3 and had some problem. I had to modify the 3rd one to use animator, then it worked. Anybody knows why? The 4th through 6th works fine. I am using RH 7.2 and java 1.4.1.

thanks a lot.


An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x4D699037

Current Java thread:
     at Method)
     - locked <0x445f0780> (a
     - locked <0x445f0780> (a
     at java.awt.Component.setBounds(
     at java.awt.BorderLayout.layoutContainer(
     - locked <0x44a97790> (a java.awt.Component$AWTTreeLock)
     at java.awt.Container.layout(
     at java.awt.Container.doLayout(
     at java.awt.Container.validateTree(
     at java.awt.Container.validate(
     - locked <0x44a97790> (a java.awt.Component$AWTTreeLock)
     at Lesson02.main(

Dynamic libraries:
08048000-0804e000 r-xp 00000000 08:11 818133     /opt/lang/java/j2sdk1.4.1_03/bin/java
...many others, too long to post...
4dc37000-4dc38000 rw-p 00013000 08:02 256794     /usr/X11R6/lib/

Local Time = Fri Sep  5 10:35:40 2003
Elapsed Time = 1
# The exception above was detected in native code outside the VM
# Java VM: Java HotSpot(TM) Client VM (1.4.1_03-b02 mixed mode)
# An error report file has been saved as hs_err_pid4564.log.
# Please refer to the file for further information.
11  Java Game APIs & Engines / JOGL Development / Re: picking on: 2003-07-24 19:48:39
Hi, Markus,

Thanks a lot. I messed up variable names that caused exception. it works now.

By the way, if the pick part is added at the end of the rendering method, another rendering method (your meshRenderer.pick) will be needed to be called at GL_SELECT mode. Can the picking be added within mouse handler? Then  one display method will be reused in different modes. I am not sure about this since the multithread issue. Any suggestions?

12  Java Game APIs & Engines / JOGL Development / Re: picking glGet on: 2003-07-24 15:51:35
I have the same question. I tried to do picking but it did not work and gave me some exceptions. I used code from OpenGL Superbible.

My concern is that I have to issue some opengl commands within mouseClicked. I remember that due to multithread issue, opengl commands should not be used within mouse or key handler. Anybody know how to do picking?


wz glGetError() returned the following error codes after a call to glRenderMode(): GL_INVALID_OPERATION
     at JoglTest.processSelection(
     at JoglTest.mouseClicked(
     at java.awt.Component.processMouseEvent(
     at java.awt.Component.processEvent(
     at java.awt.Component.dispatchEventImpl(
     at java.awt.Component.dispatchEvent(
     at java.awt.EventQueue.dispatchEvent(
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(
     at java.awt.EventDispatchThread.pumpEvents(
     at java.awt.EventDispatchThread.pumpEvents(
     at glGetError() returned the following error codes after a call to glLoadName(): GL_INVALID_OPERATION
     at JoglTest.display(
13  Java Game APIs & Engines / JOGL Development / Re: undefined symbol: gluBuild1DMipmapLevels on: 2003-07-03 17:39:29
I built it on RH 7.2 and it worked! Thanks! Grin

14  Java Game APIs & Engines / JOGL Development / Re: undefined symbol: gluBuild1DMipmapLevels on: 2003-06-27 13:33:39
I am using RH Linux 7.2 and have the same problem.

15  Java Game APIs & Engines / JOGL Development / Re: newbie question on: 2003-06-23 23:51:57

I am new to game/animation and have questions about some basics. What does one frame mean? How to find out how many frame per second an application runs at?

16  Java Game APIs & Engines / JOGL Development / newbie question on: 2003-06-23 14:35:57
I used openGL and java3D before and now I want to use openGL in ava. I noticed that there is a GL4Java and it seems still active. Could anyone tell me the difference between JOGL and GL 4java?

Thank you very much.

Pages: [1]
MrMapcom (20 views)
2015-05-23 20:26:16

MrMapcom (26 views)
2015-05-23 20:23:34

Waterwolf (32 views)
2015-05-20 15:01:45

chrislo27 (40 views)
2015-05-20 03:42:21

BurntPizza (73 views)
2015-05-10 15:53:18

FrozenShade (57 views)
2015-05-07 09:11:21

TheLopais (222 views)
2015-05-06 13:36:48

TheLopais (203 views)
2015-05-06 13:35:14

TheLopais (208 views)
2015-05-06 13:33:39

TheLopais (229 views)
2015-05-06 13:32:48
List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00 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!