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   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / JOGL Development / Re: What does gluLookAt do (what matrix operations are performed)? on: 2005-10-11 02:47:43
http://www.cs.kuleuven.ac.be/cwis/research/graphics/INFOTEC/viewing-in-3d/node8.html
I think this would be helpful Tongue
2  Java Game APIs & Engines / JOGL Development / Re: JOGL 1.1 released on: 2005-06-30 13:19:00
When could jogl move to package javax.media? As part of Mustang?
I can't wait to use it in applet~ Wink
3  Game Development / Networking & Multiplayer / Re: Is rmi a good idea in game development? on: 2005-06-30 03:18:54
Thanks for both informations!
Now I decide to use datagram directly! Grin
4  Game Development / Networking & Multiplayer / Is rmi a good idea in game development? on: 2005-06-29 14:32:40
hi!
  How about it's performance? Huh
5  Java Game APIs & Engines / JOGL Development / Re: How to use java2D within jogl? on: 2005-03-28 10:43:08
yes, by default it is. So I turn off autoSwapBuffer, then I can use java2D in onScreen context Wink
6  Java Game APIs & Engines / JOGL Development / Re: How to use java2D within jogl? on: 2005-03-26 12:22:53
I got an idea, and it works on my pc. Maybe it is a stupid idea also...isn't it? 'cause it's flickerring  :'(
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  
import net.java.games.jogl.*;

import javax.swing.*;
import java.awt.*;

import static net.java.games.jogl.GL.*;

public class Test extends JFrame implements GLEventListener {

  GLCanvas canvas;
  GL gl;
  GLU glu;

  public Test() throws HeadlessException {
    canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
    canvas.addGLEventListener(this);
    canvas.setAutoSwapBufferMode(false);
    gl = canvas.getGL();
    glu = canvas.getGLU();
    this.add(canvas);
  }

  public static void main(String[] args) {
    Test t = new Test();
    t.setSize(640, 480);
    t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    t.setLocationRelativeTo(null);
    t.setVisible(true);
  }

  public void init(GLDrawable glDrawable) {
    gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
  }

  public void display(GLDrawable glDrawable) {
    gl.glClear(GL_COLOR_BUFFER_BIT);
    gl.glLoadIdentity();
    gl.glColor3f(1f, 0, 0);
    gl.glBegin(GL_TRIANGLES);
    gl.glVertex2f(0, 0);
    gl.glVertex2f(0.5f, 0);
    gl.glVertex2f(0.5f, 0.5f);
    gl.glEnd();
    canvas.swapBuffers();
    canvas.getGraphics().drawString("Hi jogl!", 100, 100);
  }

  public void reshape(GLDrawable glDrawable, int i, int i1, int w, int h) {
    gl.glViewport(0, 0, w, h);
    gl.glMatrixMode(GL_PROJECTION);
    gl.glLoadIdentity();
    glu.gluOrtho2D(0, 0, 1, 1);
    gl.glMatrixMode(GL_MODELVIEW);
  }

  public void displayChanged(GLDrawable glDrawable, boolean b, boolean b1) {
  }
}
7  Java Game APIs & Engines / JOGL Development / How to use java2D within jogl? on: 2005-03-24 04:10:21
hi!
 Is it possible to draw some java2D things in jogl offScreen context?
 In Java3D API, I can implement postRender method of Canvas3D to paint additional things. Can I do this with jogl?

Thanks~
8  Java Game APIs & Engines / JOGL Development / What can be shared among GLDrawables(GL Contexts)? on: 2005-02-22 05:10:37
hi!
   I built a display list through GL.glGenLists() and tried to share it among a few GLCanvas, but failed.
   If sharing these things(display list, texture) can be accomplished, how?

Thanks!
9  Java Game APIs & Engines / JOGL Development / Re: Can I setRenderingThread(AWT-EventQueue-Thread on: 2005-02-12 23:23:23
Got it!
Thank you Ken Smiley
10  Java Game APIs & Engines / JOGL Development / Can I setRenderingThread(AWT-EventQueue-Thread)? on: 2005-02-11 08:24:59
I have read Jogl - User's Guide, which says
It is generally recommended that applications perform as little work as possible inside their mouse and keyboard handlers to keep the GUI responsive. However, since OpenGL commands can not be run from directly within the mouse or keyboard event listener, the best practice is to store off state when the listener is entered and retrieve this state during the next call to GLEventListener.display().

I'm wondering what is the disadvantage if I write code like following. What is the proper way to render in "repaint only on demand" mode? I also want to know is there any boost in performance if I turn on switch "-DJOGL_SINGLE_THREADED_WORKAROUND=true"?

Thanks

/////////////////////////        code         ////////////////////////
import static net.java.games.jogl.GL.*;
import net.java.games.jogl.*;
import net.java.games.jogl.util.BufferUtils;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.nio.IntBuffer;

public class Test extends JFrame implements GLEventListener, MouseListener {

 GLCanvas canvas;
 GL gl;
 GLU glu;

 public Test() throws HeadlessException {
   canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
   gl = canvas.getGL();
   glu = canvas.getGLU();
   canvas.addGLEventListener(Test.this);
   canvas.addMouseListener(Test.this);
   add(canvas);
   addComponentListener(new ComponentAdapter() {
     public void componentShown(ComponentEvent e) {
       System.out.println(Thread.currentThread());
       canvas.setRenderingThread(Thread.currentThread());
     }
   });
 }

 public static void main(String[] args) {
   Test t = new Test();
   t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   t.setSize(640, 480);
   t.setLocationRelativeTo(null);
   t.setVisible(true);
 }

 private void processHits(int hits, IntBuffer buffer) {
   System.out.println("hits = " + hits);
   int ptr = 0;
   for(int i=0; i<hits; i++) {
     int names = buffer.get(ptr);
     System.out.println(" number of names for hit = " + names); ptr++;
     System.out.println(" z1 is " + (float)buffer.get(ptr)/0x7fffffff + ";"); ptr++;
     System.out.println(" z2 is " + (float)buffer.get(ptr)/0x7fffffff + ";"); ptr++;
     System.out.print(" names are ");
     int ii = 0, jj = 0;
     for(int j=0; j<names; j++) {
       System.out.print(buffer.get(ptr));
       if(j==0) ii = buffer.get(ptr);
       else if(j==1) jj = buffer.get(ptr);
       ptr++;
     }
     System.out.println();
     board[ii][jj] = (board[ii][jj]+1)%3;
   }
 }

 final int BUFSIZE = 512;

 private int[][] board = new int[3][3];

 public void init(GLDrawable glDrawable) {
   gl.glClearColor(0f, 0f, 0f, 0f);
 }

 private void drawSquares(int mode) {
   for(int i=0; i<3; i++) {
     if(mode==GL_SELECT) gl.glLoadName(i);
     for(int j=0; j<3; j++) {
       if(mode==GL_SELECT) gl.glPushName(j);
       gl.glColor3f((float)i/3, (float)j/3, (float)board[j]/3);
       gl.glRecti(i, j, i+1, j+1);
       if(mode==GL_SELECT) gl.glPopName();
     }
   }
 }

 public void display(GLDrawable glDrawable) {
   gl.glClear(GL_COLOR_BUFFER_BIT);
   drawSquares(GL_RENDER);
   gl.glFlush();
 }

 public void reshape(GLDrawable glDrawable, int x, int y, int w, int h) {
   gl.glViewport(0, 0, w, h);
   gl.glMatrixMode(GL_PROJECTION);
   gl.glLoadIdentity();
   glu.gluOrtho2D(0, 3, 0, 3);
   gl.glMatrixMode(GL_MODELVIEW);
   gl.glLoadIdentity();
 }

 public void displayChanged(GLDrawable glDrawable, boolean b, boolean b1) {}

 public void mousePressed(MouseEvent e) {
   IntBuffer selectBuf = BufferUtils.newIntBuffer(BUFSIZE);
   int[] viewport = new int[4];
   gl.glGetIntegerv(GL_VIEWPORT, viewport);

   gl.glSelectBuffer(BUFSIZE, selectBuf);
   gl.glRenderMode(GL_SELECT);

   gl.glInitNames();
   gl.glPushName(0);

   gl.glMatrixMode(GL_PROJECTION);
   gl.glPushMatrix();
   gl.glLoadIdentity();
   glu.gluPickMatrix(e.getX(), viewport[3]-e.getY(), 5, 5, viewport);
   glu.gluOrtho2D(0, 3, 0, 3);
   drawSquares(GL_SELECT);

   gl.glMatrixMode(GL_PROJECTION);
   gl.glPopMatrix();
   gl.glFlush();

   int hits = gl.glRenderMode(GL_RENDER);
   processHits(hits, selectBuf);
   canvas.repaint();
 }

 public void mouseClicked(MouseEvent e) {}
 public void mouseReleased(MouseEvent e) {}
 public void mouseEntered(MouseEvent e) {}
 public void mouseExited(MouseEvent e) {}
}
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.

rwatson462 (38 views)
2014-12-15 09:26:44

Mr.CodeIt (31 views)
2014-12-14 19:50:38

BurntPizza (62 views)
2014-12-09 22:41:13

BurntPizza (99 views)
2014-12-08 04:46:31

JscottyBieshaar (60 views)
2014-12-05 12:39:02

SHC (74 views)
2014-12-03 16:27:13

CopyableCougar4 (77 views)
2014-11-29 21:32:03

toopeicgaming1999 (138 views)
2014-11-26 15:22:04

toopeicgaming1999 (127 views)
2014-11-26 15:20:36

toopeicgaming1999 (38 views)
2014-11-26 15:20:08
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

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