Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (523)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
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.

wz
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!!!

wz
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. :-)

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

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.

wz
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.

wz
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?

wz
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.

Thanks.

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

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

Thanks.

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

wz

/*
* 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.*;

import net.java.games.jogl.*;
import net.java.games.jogl.util.*;

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();
           caps.setDoubleBuffered(true);
           caps.setAlphaBits(8);
           caps.setStencilBits(8);
           canvas = GLDrawableFactory.getFactory().createGLCanvas(caps);

           
           canvas.addGLEventListener(this);
           canvas.setGL(new DebugGL(canvas.getGL()));
           canvas.addMouseListener(this);
           canvas.addMouseMotionListener(this);
           canvas.addKeyListener(this);

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

           frame.addWindowListener(new WindowAdapter() {
                 public void windowClosing(WindowEvent e) {
                       animator.stop();
                       System.exit(0);
                 }
           });

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

     public void initialiseDisplay() {
           frame.show();
     }

     public void run() {
           animator.start();
     }

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

           JoglTest app = new JoglTest();
           app.initialiseDisplay();

           // Other loading/initialisation
           // ..

           // Start main game loop
           app.run();
     }

     // 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
           gl.glFrontFace(GL.GL_CW);
           gl.glEnable(GL.GL_LIGHTING);
           gl.glEnable(GL.GL_LIGHT0);
           gl.glEnable(GL.GL_AUTO_NORMAL);
           gl.glEnable(GL.GL_NORMALIZE);
           gl.glDepthFunc(GL.GL_LESS);
           gl.glEnable(GL.GL_DEPTH_TEST);

           gl.glMatrixMode(GL.GL_PROJECTION);
           gl.glLoadIdentity();
           gl.glMatrixMode(GL.GL_TEXTURE);
           gl.glLoadIdentity();
           gl.glMatrixMode(GL.GL_MODELVIEW);
           gl.glLoadIdentity();

     }

     public void display(GLDrawable drawable) {

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

           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();
           //setLightmat(gl);

           gl.glClearColor(0.2f, 0.2f, 0.2f, 0.0f);
           gl.glClear(
                 GL.GL_COLOR_BUFFER_BIT
                       | 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.glPushMatrix();
           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.glPushMatrix();

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

           //gl.glPopMatrix();
           //gl.glPopName();
           gl.glPopMatrix();

           gl.glPushMatrix();
           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.glPushMatrix();

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

           gl.glLoadName(2);

           glut.glutSolidTetrahedron(gl);

           //gl.glPopMatrix();
           //gl.glPopName();
           gl.glPopMatrix();
           gl.glFlush();

     }

     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.glMatrixMode(GL.GL_PROJECTION);
           //gl.glOrtho(0, 4, 0, 3, -8, 8);

           gl.glMatrixMode(GL.GL_PROJECTION);
           gl.glLoadIdentity();
           glu.gluPerspective(30.0, (float) width / (float) height, 1.0, 50);
           gl.glMatrixMode(GL.GL_MODELVIEW);
           gl.glLoadIdentity();
           //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);
           gl.glMatrixMode(GL.GL_PROJECTION);
           gl.glPushMatrix();

           gl.glRenderMode(GL.GL_SELECT);
           gl.glLoadIdentity();
           glu.gluPickMatrix(x, viewport[3] - y, 5, 5, viewport);
           glu.gluPerspective(30.0f, fAspect, 1.0, 50);
           draw(drawable);
           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;
           }

           gl.glMatrixMode(GL.GL_PROJECTION);
           gl.glPopMatrix();
           gl.glMatrixMode(GL.GL_MODELVIEW);
           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;

           switch(pickedName){
                 case 1:
                       view_rotX_1 += thetaX;
                       view_rotY_1 += thetaY;
                       break;
                 case 2:
                       view_rotX_2 += thetaX;
                       view_rotY_2 += thetaY;
                       break;
           }
     }

     public void mouseMoved(MouseEvent e) {
     }

     public void keyPressed(KeyEvent e) {
           processKey(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
Hi,

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.

wz

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x4D699037
Function=XVisualIDFromVisual+0x7
Library=/usr/X11R6/lib/libX11.so.6

Current Java thread:
     at net.java.games.jogl.impl.JAWT_DrawingSurface.GetDrawingSurfaceInfo0(Native Method)
     at net.java.games.jogl.impl.JAWT_DrawingSurface.GetDrawingSurfaceInfo(JAWT_DrawingSurface.java:42)
     at net.java.games.jogl.impl.x11.X11OnscreenGLContext.lockSurface(X11OnscreenGLContext.java:167)
     at net.java.games.jogl.impl.x11.X11OnscreenGLContext.makeCurrent(X11OnscreenGLContext.java:108)
     - locked <0x445f0780> (a net.java.games.jogl.impl.x11.X11OnscreenGLContext)
     at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:162)
     - locked <0x445f0780> (a net.java.games.jogl.impl.x11.X11OnscreenGLContext)
     at net.java.games.jogl.GLCanvas.reshape(GLCanvas.java:119)
     at java.awt.Component.setBounds(Component.java:1665)
     at java.awt.BorderLayout.layoutContainer(BorderLayout.java:683)
     - locked <0x44a97790> (a java.awt.Component$AWTTreeLock)
     at java.awt.Container.layout(Container.java:1017)
     at java.awt.Container.doLayout(Container.java:1007)
     at java.awt.Container.validateTree(Container.java:1089)
     at java.awt.Container.validate(Container.java:1064)
     - locked <0x44a97790> (a java.awt.Component$AWTTreeLock)
     at java.awt.Window.show(Window.java:455)
     at Lesson02.main(Lesson02.java:146)

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/libXmu.so.6.2

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?

wz
12  Java Game APIs & Engines / JOGL Development / Re: picking net.java.games.jogl.GLException: 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?

Thanks.

wz

net.java.games.jogl.GLException: glGetError() returned the following error codes after a call to glRenderMode(): GL_INVALID_OPERATION
     at net.java.games.jogl.DebugGL.checkGLGetError(DebugGL.java:9741)
     at net.java.games.jogl.DebugGL.glRenderMode(DebugGL.java:6351)
     at JoglTest.processSelection(JoglTest.java:183)
     at JoglTest.mouseClicked(JoglTest.java:217)
     at java.awt.Component.processMouseEvent(Component.java:5137)
     at java.awt.Component.processEvent(Component.java:4931)
     at java.awt.Component.dispatchEventImpl(Component.java:3639)
     at java.awt.Component.dispatchEvent(Component.java:3480)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
net.java.games.jogl.GLException: glGetError() returned the following error codes after a call to glLoadName(): GL_INVALID_OPERATION
     at net.java.games.jogl.DebugGL.checkGLGetError(DebugGL.java:9741)
     at net.java.games.jogl.DebugGL.glLoadName(DebugGL.java:4970)
     at JoglTest.display(JoglTest.java:134)
     at net.java.games.jogl.impl.GLDrawableHelper.display(GLDrawableHelper.java:74)
     at net.java.games.jogl.GLCanvas$DisplayAction.run(GLCanvas.java:208)
     at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:192)
     at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:196)
     at net.java.games.jogl.GLCanvas.display(GLCanvas.java:91)
     at net.java.games.jogl.Animator$1.run(Animator.java:104)
     at java.lang.Thread.run(Thread.java:536)
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

wz
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.

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

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?

wz
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.

wz
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.

SHC (23 views)
2014-11-25 12:00:59

SHC (21 views)
2014-11-25 11:53:45

Norakomi (19 views)
2014-11-25 11:26:43

Gibbo3771 (22 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (74 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (41 views)
2014-11-12 21:09:33

kovacsa (67 views)
2014-11-07 19:57: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

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!