Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (105)
games submitted by our members
Games in WIP (524)
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 / OpenGL Development / jogl vs LWJGL on: 2004-05-09 12:13:21
what API is better and why?
2  Java Game APIs & Engines / JOGL Development / what is wrong with this code on: 2004-05-08 17:39:36
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  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
package test;

import hr.ib.math3D.*;
import net.java.games.jogl.*;

public class Body
{
  private Matrix4d orientation, translation ,transformation;
  public Matrix4d getTransformation()
  {
    return transformation;
  }

  public Matrix4d getOrientation()
  {
    return orientation;
  }

  public Matrix4d getTranslation()
  {
    return translation;
  }

  public Body(Point3D position, Matrix4d orientation)
  {
    this.translation=new Matrix4d(1.0, 0.0, 0.0, position.x, 0.0, 1.0, 0.0, position.y, 0.0, 0.0, 1.0, position.z, 0.0, 0.0, 0.0, 1.0);
    this.orientation=new Matrix4d(orientation);
   
    transformation=new Matrix4d(orientation);
    transformation.mul(translation);
  }
 
 
  public void rotateX(double degrees)
  {
    Matrix4d rot=new Matrix4d();
    rot.rotX(Math.toRadians(degrees));
    orientation.mul(rot);
   
    transformation=new Matrix4d(orientation);
    transformation.mul(translation);
  }
 
  public void rotateY(double degrees)
  {
    Matrix4d rot=new Matrix4d();
    rot.rotY(Math.toRadians(degrees));
    orientation.mul(rot);
   
    transformation=new Matrix4d(orientation);
    transformation.mul(translation);
  }
 
  public void rotateZ(double degrees)
  {
    Matrix4d rot=new Matrix4d();
    rot.rotZ(Math.toRadians(degrees));
    orientation.mul(rot);
   
    transformation=new Matrix4d(orientation);
    transformation.mul(translation);
  }
 
  public  void moveLocalZ(double meters)
  {
    translation.m03 += orientation.m20 * meters;
    translation.m13 += orientation.m21 * meters;
    translation.m23 += orientation.m22 * meters;
   
    transformation=new Matrix4d(orientation);
    transformation.mul(translation);
  }

  public  void moveLocalY(double meters)
  {
   
    translation.m03 += orientation.m10 * meters;
    translation.m13 += orientation.m11 * meters;
    translation.m23 += orientation.m12 * meters;
   
    transformation=new Matrix4d(orientation);
    transformation.mul(translation);
  }

  public  void moveLocalX(double meters)
  {
    translation.m03 += orientation.m00 * meters;
    translation.m13 += orientation.m01 * meters;
    translation.m23 += orientation.m02 * meters;
   
    transformation=new Matrix4d(orientation);
    transformation.mul(translation);
  }
 
 
 
  public Point3D getPosition()
  {
    return new Point3D(translation.m03,translation.m13,translation.m23);  }
 
  public Matrix4d getInverseTransformation()
  {
    Matrix4d trans=new Matrix4d(translation);
    trans.invert();
    Matrix4d  or=new Matrix4d(orientation);
    or.invert();
    trans.mul(or);
    return trans;
  }


 
  public void drawMe(GL gl)
  {
    gl.glColor3d(1,1,1);
    gl.glBegin(gl.GL_QUADS);
    //Front Face
   gl.glNormal3d(0,0,1);
    gl.glVertex3d( -1, -1, 1); //Bottom Left Of The Texture and Quad
   gl.glVertex3d(1, -1, 1); //Bottom Right Of The Texture and Quad
   gl.glVertex3d(1, 1, 1); //Top Right Of The Texture and Quad
   gl.glVertex3d( -1, 1, 1); //Top Left Of The Texture and Quad
   //Back Face
   gl.glNormal3d(0,0,-1);
    gl.glVertex3d( -1, -1, -1); //Bottom Right Of The Texture and Quad
   gl.glVertex3d( -1, 1, -1); //Top Right Of The Texture and Quad
   gl.glVertex3d(1, 1, -1); //Top Left Of The Texture and Quad
   gl.glVertex3d(1, -1, -1); //Bottom Left Of The Texture and Quad
   //Top Face
   gl.glNormal3d(0,1,0);
    gl.glVertex3d( -1, 1, -1); //Top Left Of The Texture and Quad
   gl.glVertex3d( -1, 1, 1); //Bottom Left Of The Texture and Quad
   gl.glVertex3d(1, 1, 1); //Bottom Right Of The Texture and Quad
   gl.glVertex3d(1, 1, -1); //Top Right Of The Texture and Quad
   //Bottom Face
   gl.glNormal3d(0,-1,0);
    gl.glVertex3d( -1, -1, -1); //Top Right Of The Texture and Quad
   gl.glVertex3d(1, -1, -1); //Top Left Of The Texture and Quad
   gl.glVertex3d(1, -1, 1); //Bottom Left Of The Texture and Quad
   gl.glVertex3d( -1, -1, 1); //Bottom Right Of The Texture and Quad
   //Right face
   gl.glNormal3d(1,0,0);
    gl.glVertex3d(1, -1, -1); //Bottom Right Of The Texture and Quad
   gl.glVertex3d(1, 1, -1); //Top Right Of The Texture and Quad
   gl.glVertex3d(1, 1, 1); //Top Left Of The Texture and Quad
   gl.glVertex3d(1, -1, 1); //Bottom Left Of The Texture and Quad
   //Left Face
   gl.glNormal3d(-1,0,0);
    gl.glVertex3d( -1, -1, -1); //Bottom Left Of The Texture and Quad
   gl.glVertex3d( -1, -1, 1); //Bottom Right Of The Texture and Quad
   gl.glVertex3d( -1, 1, 1); //Top Right Of The Texture and Quad
   gl.glVertex3d( -1, 1, -1); //Top Left Of The Texture and Quad
   gl.glEnd();  
  }
}




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  
class Test
{
  Body camera, cube;
 
 Test()
 {
    Matrix4d startingOrientation=new  Matrix4d(1.0,0.0,0.0,0.0,   0.0,1.0,0.0,0.0,   0.0,0.0,-1.0,0.0,    0.0,0.0,0.0,1.0);
   
    camera=new Body(new Point3D(0,0,0),startingOrientation);
   
    cube=new Body(new Point3D(0,0,-10),startingOrientation);
}


public void display(GLDrawable drawable)
    {
      gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
     
      gl.glLoadMatrixd(camera.getInverseTransformation().getCM());
      gl.glMultMatrixd(cube.getTranslation().getCM());
      gl.glMultMatrixd(cube.getOrientation().getCM());
   
      cube.drawMe(gl);
    }

}


public void keyPressed(KeyEvent ke)
    {
      if(camera!=null)
      {
        if (ke.getKeyCode() == KeyEvent.VK_RIGHT)
        {
          camera.rotateY(-1);
        }
        else if (ke.getKeyCode() == KeyEvent.VK_LEFT)
        {
          camera.rotateY(1);
        }
        else if (ke.getKeyCode() == KeyEvent.VK_UP)
        {
          camera.rotateX(1);
        }
        else if (ke.getKeyCode() == KeyEvent.VK_DOWN)
        {
          camera.rotateX(-1);
        }
        else if (ke.getKeyCode() == KeyEvent.VK_END)
        {
          camera.moveLocalZ( -1);
        }
        else if (ke.getKeyCode() == KeyEvent.VK_HOME)
        {
          camera.moveLocalZ(1);
        }
      }
     
    }




I am using javax.vecmath.Matrix4d for storing rotation and translation matrix.
Some parts of code aren't shown here because it is not important for the problem.
The problem is that moving camera doesn't work as it should.

3  Java Game APIs & Engines / JOGL Development / Re: camera transformation matrix on: 2004-05-07 10:27:39
Quote
Have you looked at javax.vecmath, wich is part of Java3D?

There is javax.vecmath.Matrix4f.invert() wich inverts a matrix.


thanx, thats what I found yesterday on google, I hope that will solve my problems...
4  Java Game APIs & Engines / JOGL Development / Re: how to map texture to non rectangular polygon on: 2004-05-06 17:23:10
thanx, but that' not really answer to my question. I know how to aply texture to QUAD, but can anybody provide some sample code for aplying texture to a polygon (pentagon for example).
5  Java Game APIs & Engines / JOGL Development / how to map texture to non rectangular polygon ? on: 2004-05-06 15:23:53
In all tutorials the examples are about aplying texture to rectangular surfaces by using glBegin(GL_QUADS).

How can I map texture to a custom polygonal surface ?
6  Java Game APIs & Engines / JOGL Development / display lists performance on: 2004-05-06 14:53:02
I am interested in what scale can display lists improve performance. Let's suppose that we have 500 objects that all use same geometry and they are moving around in virtual space.

Is performance much defferent  with usage of display lists then performance when we don't use display lists?
7  Java Game APIs & Engines / JOGL Development / glLoadMatrix, what is it used for on: 2004-05-06 12:59:25
does glLoadMatrix() sets the value for current matrix?
8  Java Game APIs & Engines / JOGL Development / Re: camera transformation matrix on: 2004-05-06 11:59:35
I have my class representing objects, they have rotation matrix, translation matrix and transformation matrix data stored as instances of Transform3D.class I found on the net. I think it has sam logic as java3d's Transform3D but it is quite simpler.

So you said that I need to calculate inverse transformation by multiplying inverse rotation with inverse translation. That's OK, but I dont know hot to get inverse matrix of rotation and translation.

Do you use your own algoritam or you have some math library for that?
9  Java Game APIs & Engines / JOGL Development / Re: camera transformation matrix on: 2004-05-05 21:04:54
1)  how do you calculate inverse matrix?
2 In what form do you keep your matrix data ?
3, to draw object after we aplied inverse transformation of the camera, we aply transformation matrix of object or again inverse transfomation matrix of the object?
10  Java Game APIs & Engines / JOGL Development / Re: Fog Question.. on: 2004-05-04 07:49:03
I think what you need is volumetric fog. That effect is more like real fog, but it is much more complicated to implement.... Volumetric fog is the fog that doesn't apear all over the scee, but on some part of your virtual world.

Normal OpenGL fog just applies fog color to objects in different alpha values. Alpha value is bigger on close objects and smaller on distant objects, so if the object if far enough fog color will completely cover it.
If all of your scene is filled with objects or terein surface you should get desired result, if not, you should set same color on backround and fog.
11  Games Center / Java Technology Game Development Contest - 2004 / Contestants list on: 2004-05-03 15:43:55
I think Sun should publish a list of Contestants who aplied and whose entry forms are received.
I faxed the Entry form, but I have no idea is it received.

I think this list would helpfull for everyone who aplied.

Chriss?
12  Discussions / General Discussions / Yabb member profiles on: 2004-05-02 11:58:05
I 'm just interested when does profile change from Yabb newbie to something else? Does it depend on number of posts? What are all possible Yabb "ranks" and what does they mean?
13  Java Game APIs & Engines / JOGL Development / camera transformation matrix on: 2004-05-02 09:28:07
Hi, I have object representing camera, It has it's own transformation matrix. The question is how to use that matrix to position the camera in OpenGL.
I tried gl.glLoadMatrix(cameratransformationmatrix) but I haven't got desired result

please help...
14  Java Game APIs & Engines / Java Sound & OpenAL / Re: joal vs Java Sound on: 2004-04-29 15:50:14
Yes, except this question I have another one:
If I choose to use joal, how stabile is it, is it mature enough to use it in game developement?
15  Java Game APIs & Engines / Java Sound & OpenAL / joal vs Java Sound on: 2004-04-29 12:14:00
Hi,
I need to choose sound API for my game, should I choose joal or something else.

By now I used AudioClip.play() for playing sounds but it's performance is poor, it consumes to much of procesor time. Is joal better?

16  Games Center / Java Technology Game Development Contest - 2004 / Re: Rules clarification questions on: 2004-04-15 06:47:01
what about JDOM?
I need to use xml for configuration and saving game progress etc.
Is JDOM allowed, since it is not Sun's API?

Chriss?

17  Games Center / Java Technology Game Development Contest - 2004 / Re: 3d modeling tool on: 2004-04-09 09:20:41
WTF, this link is about farmacy, medication etc...
www.wings3d.org
maybe that domain is sold or something....

any other suggestions?
18  Games Center / Java Technology Game Development Contest - 2004 / 3d modeling tool on: 2004-04-09 07:38:23
Does anybody know some tool which I can use to visually model (draw) 3D objects and then export it in various file formats. I preffer simple formats because I will probably parse them directly from my code.
....

19  Java Game APIs & Engines / JOGL Development / Re: How to draw circle with radial gradient fill on: 2004-04-07 08:21:30
thanx, man, you rock!
20  Java Game APIs & Engines / JOGL Development / Re: How to draw circle with radial gradient fill on: 2004-04-06 20:50:52
Quote
WTF? This is dead easy, just make a circle from a triangle fan with its root at the center and use vertex colours for the gradient. Cleaner, simpler, better quality result. Smiley


can you provide sample code, please? I 'm sorry, but I am new to Open GL.
One more thing? is it posible to combine Java2D and jogl?
21  Java Game APIs & Engines / JOGL Development / How to draw circle with radial gradient fill on: 2004-04-06 15:04:24
The subject is the question..
22  Games Center / Java Technology Game Development Contest - 2004 / Re: Rules clarification questions on: 2004-03-31 19:05:09
more questions:

2. What are speciifications of testing machines for the games?

3. After we submit executables will anybody confirm if game instalation is OK. My fear comes from the fact that game could work on my testing machine but it could be problematic on some other (I hope this will not happen), but just in case...
23  Games Center / Java Technology Game Development Contest - 2004 / Re: Rules clarification questions on: 2004-03-31 18:30:39
OK, thx. I missed it before :-)
24  Games Center / Java Technology Game Development Contest - 2004 / Rules clarification questions on: 2004-03-31 18:20:06
1. Is jogl defenetlly allowed to use?

25  Java Game APIs & Engines / Java 3D / Re: Future of Java 3D on: 2004-03-10 11:53:58
I sent e-mail with same question  to Doug, but no response yet.
26  Java Game APIs & Engines / Java 3D / Future of Java 3D on: 2004-03-10 10:11:50
HI, I am developing 3D java game, so I suposed I should use java 3D. Then I found out that Sun stoped developing 3D API and some people say that it is better to use xith3D or something. So what can you recomend me to do?
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 (26 views)
2014-07-12 17:50:04

Riven (31 views)
2014-07-10 20:20:18

CopyableCougar4 (29 views)
2014-07-10 02:26:14

CopyableCougar4 (32 views)
2014-07-09 02:55:38

Code Mage (33 views)
2014-07-08 23:57:00

Code Mage (20 views)
2014-07-08 23:49:08

AppleSauce (28 views)
2014-07-08 19:25:32

CopyableCougar4 (29 views)
2014-07-06 01:51:26

ipe369 (35 views)
2014-07-05 14:18:25

vastrolorde (44 views)
2014-07-04 18:45:44
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!