Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
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: using drag and drop on: 2005-04-13 13:21:41
Actually all dragging and droping is inside the same component. The MouseInputListener is just what I want. Thanks!
2  Java Game APIs & Engines / JOGL Development / using drag and drop on: 2005-04-13 12:38:13
Hi to everyone. I'm trying to create a custom window class inside my GLCanvas. Ofcourse I'd like drag and drop support for my windows so I can move them around. What listener should I use so I can track mouse motion when a mouse button is pressed? I tried this:
1  
2  
3  
4  
5  
 public void mouseClicked(MouseEvent e) {
      if (e.getID() == MouseEvent.MOUSE_DRAGGED) {
          System.out.println("Mouse Dragged!");
      } else if (e.getButton() == MouseEvent.BUTTON3) {
        //......etc etc

but it doesn't work. Any help?
3  Java Game APIs & Engines / JOGL Development / Re: Problem with glGetIntegerv/glGetDoublev on: 2005-03-21 19:06:28
Ok, suppose you have this class
1  
2  
3  
public class GLfunctions extends JPanel implements GLEventListener, MouseListener, 
      MouseWheelListener, KeyListener, Animated {
....

The methods that implement MouseListener are run on a different thread from GLfunctions?
4  Java Game APIs & Engines / JOGL Development / opening image files for textures (applet) on: 2005-03-21 09:45:00
Hi to everyone, once again. I've made my applet and locally it works ok. Now I'm just trying to resolve some problems with serving it from a web server.
In the applet I open a few .tga files that are used as textures. The problem is I can't understand the relative path to open the file.
The classes are in a jar file. They're also in a package (say com/mycompany/myproject) so in the jar file they're under this path. Now what I'd like to do when I load the files is:
texture = LoadTGA("tex" + i + ".tga");
I checked the permission and fixed them, so there's no security problem at the moment. But how do I load the images? For this to work I need to pass the absolute path, which is a bit inapropriate. For the above code I get a NullPointerException so I suppose it can't find my images. So where do I need to place the image files for this to work?
5  Java Game APIs & Engines / JOGL Development / firefox a bit slow on my applet on: 2005-03-15 21:46:48
Hi to everyone, once again. I'm pretty much finished building my test applet. I'm loading quite a few textures (6 24-bit textures 2048x2048 each + 1 32-bit 2048x2048) and render 1000 quads on screen. The program zooms in where the user clicks, zooms out etc.
My problem is that firefox is a bit slow when doing this. I also tested with IE6 and the appletviewer and both gave the same speed. But firefox seems to lag (the animation is not smooth). Does anyone have any ideas why this must be happening? I wouldn't want to give my users a reason to prefer IE over firefox! Thanks
6  Java Game APIs & Engines / JOGL Development / Re: some startup questions about Jogl on: 2005-03-15 21:40:11
Well, if I've understood your question, apart from the windowing stuff that each platform handles a bit differently (Java, Win32, X) there isn't much difference. You should pay attention to the fact that you must be in the correct thread to run gl code. I mean, using C I used to put my mouse handling routines (that used gl functions) in the mouse callback. That's not possible with JOGL so I just raise a flag and handle them inside display, before anything else.
Last thing, I just find a nuissance that we have to double the gl. Can't they remove it from the method calls? So we write:
gl.Enable(GL.DEPTH_TEST);
instead of:
gl.glEnable(GL.GL_DEPTH_TEST);
7  Java Game APIs & Engines / JOGL Development / Re: right click menu not showing correctly on: 2005-03-14 14:13:08
False alarm. It must have been a bug with the driver. A reboot and we're good to go.
8  Java Game APIs & Engines / JOGL Development / right click menu not showing correctly on: 2005-03-14 13:42:32
Greetings. I'm using a popup menu in my app like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
PopupMenu contextMenu;
....
contextMenu = new PopupMenu();
glCanvas.add(contextMenu);
...and in mouseClicked callback:
if (e.getButton() == MouseEvent.BUTTON3) {
          contextMenu.removeAll();
          contextMenu.add("One");
          contextMenu.add("Two");
          contextMenu.addSeparator();
          contextMenu.add("Three");
          contextMenu.add("Four");
          contextMenu.show(glCanvas, e.getX(), e.getY());      
}

The menu used to show fine, but after some changes it is fully transparent. I mean I can see the shadow that it produces on my glCanvas, but I can't see the menu. If I pass the mouse over the menu items and highlight them, then they start showing up. What's my problem here? I suspect it is something trivial. Could it be that I'm loading a 32-bit transparent .tga texture? But I disable GL_BLEND when I'm done rendering this.
9  Java Game APIs & Engines / JOGL Development / Re: my applet is slow on: 2005-03-13 17:12:30
Hmm, I hadn't thought of that. Thanks!
10  Java Game APIs & Engines / JOGL Development / Re: my applet is slow on: 2005-03-13 14:45:10
Hmm, I nailed down the cause of the problem. Looking at another post here that has, suspiciously similar, problems, I tried commenting out things that I rendered to see if I can get an improvement. And voila! after commenting out a for that produces 1000 gluDisks that I rendered the problem goes away.
The thing is, the disks are needed. Also, when I used gluDisk with C++ I initialized the object once at startup (gluNewQuadric) and deleted once the program was finished (gluDeleteQuadric). I could draw as many objects as I wanted with just one quadric object.
However when I did this in my project I got a nullPointerException and I have to create and delete every disk that I create. Obviously that's not good.
Though the nullPointerException is weird. I use netBeans and when I run the project through the appletviewer everything is fine. But when I try to run it through a browser, I get the nullPointerExtension in gluDisk. Should I just forget the gluDisks and go with my own impementation?

Yeeaaah baby!!! I just removed the gluDisk and rendered with quads instead of circles and got around 63 fps!
So the problem lies with the implementation of gluDisk from JOGL?
11  Java Game APIs & Engines / JOGL Development / Re: my applet is slow on: 2005-03-13 14:21:30
You're right about the 6000 value, I don't know what I was thinking.  Embarrassed I guess I got confused.
Anyway, I tried removing the textures and I still get 10-11 fps. Any ideas why this is happening?
Could it be that I'm not using an Animator class to do the rendering? Instead I use glCanvas.repaint();
12  Java Game APIs & Engines / JOGL Development / my applet is slow on: 2005-03-13 11:57:20
I'd like to ask a few questions, because I'm fairly new to Java and I don't know if I'm doing everything correctly.
I'm trying to build an applet which is graphics-heavy. By this, I mean I'm loading 6 2048x2048 24 bit png textures on the screen, as well as a 512x512 32 bit tga texture. What I need to do is when I click somewhere on one of my textures, the program zooms in to that spot.
To accomplish that I manipulate the camera using gluLookAt and change the values. I also change the view frustum like:
1  
2  
3  
4  
5  
gl.glMatrixMode(GL.GL_PROJECTION);
          gl.glLoadIdentity();
          gl.glOrtho(-zoomWidth, zoomWidth, -zoomHeight, zoomHeight, -10, 10);
          gl.glMatrixMode(GL.GL_MODELVIEW);
          gl.glLoadIdentity();

Everything was good up to that point. Then I thought, I'd add a smooth animation, so when the user clicks on a spot, the camera and the view frustum gradually "move" to that point. The problem with this approach is that it seems pretty slow. I tried putting a timer to get the FPS like this:
1  
2  
3  
4  
5  
6  
7  
8  
framesPerSecond++;
currentFrameTime = System.currentTimeMillis();

if ((currentFrameTime - previousFrameTime) > 6000) {
    System.out.println("FPS: " + framesPerSecond);
    previousFrameTime = currentFrameTime;
    framesPerSecond = 0;
}

in my display callback. It shows that I get 55 to 60 fps (I've got a loaned ATI Radeon 9600 w/ 256MB of memory).
But if I'm getting 55 to 60 fps, why my display is slow? Am I missing something here? Another thing to note is that the fps println comes every 4-5 seconds. Why is that?
I forgot to mention that my applet runs on a thread.
Sorry for the long post, but there seems to be something fundamental that I'm missing here.
13  Java Game APIs & Engines / JOGL Development / using gluUnProject on: 2005-03-09 14:19:59
Greetings, once more. I'm trying to use gluUnProject to get world coordinates for my mouse. However the calls to glGetIntegerv, glGetDoublev to get the viewport, modelview and projection matrices return 0 values.
My questions are:
Can I do this inside the Mouse Listener methods:
I still need a gl, glu object. How do I pass these to:
public void mouseClicked(MouseEvent e)

right now I've created a helper class:
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  
class TransformMouseCoords {
    GLDrawable glDrawable;
   
    public void initClass(GLDrawable glDrawable) {
      this.glDrawable = glDrawable;
     
    }
    public void makeTransform(int x, int y, double worldX, double worldY) {
      GL gl = glDrawable.getGL();
      GLU glu = glDrawable.getGLU();
     
      int[] viewport = new int[4];
      double[] mvmatrix = new double[16];
      double[] projmatrix = new double[16];
      int realy;
      double[] worldCoords = new double[3];
      /*double[] wy = new double[1];
      double[] wz = new double[1];*/

     
      gl.glGetIntegerv(GL.GL_VIEWPORT, viewport);
      gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, mvmatrix);
      gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, projmatrix);
      realy = viewport[3] - y  - 1;
      System.out.println("Coordinates at cursor: (" + x + ", " + realy + ")");
      for (int i = 0; i < 4; i++)
          System.out.println(viewport[i]);
     
      for (int i = 0; i < 16; i++) {
          System.out.println(projmatrix[i]);
      }
      for (int i = 0; i < 16; i++) {
          System.out.println(mvmatrix[i]);
      }
      glu.gluUnProject((double)x, (double)realy, 0.0,
            mvmatrix, projmatrix, viewport,
            worldCoords);
      worldX = worldCoords[0];
      worldY = worldCoords[1];
      System.out.println("Coordinates at world: (" + worldCoords[0] + ", " + worldCoords[1] + ")");
    }
}

which I call in mouseClicked.
1  
2  
3  
4  
5  
6  
7  
public void mouseClicked(MouseEvent e) {
        int x = e.getX();
        int y = e.getY();
        double worldX = 0, worldY = 0;
        tmc.makeTransform(x, y, worldX, worldY);
        System.out.println("we got coordinates: (" + worldX + ", " + worldY + ")");
    }

Am I missing something in passing variables in Java? Why are my viewport, modelview and projection matrices filled with zeros?
PS. I call initClass inside my display callback, just to be sure I get a valid glDrawable each time. Is this correct?
14  Java Game APIs & Engines / JOGL Development / Re: security proble with the applet on: 2005-03-08 22:09:39
Yep, the card goes up to 2048. I had no idea that there was a limit to the size of the texture (apart from memory issues). I gues we need to tile the application to get to a higher resolution. Thanks again!
15  Java Game APIs & Engines / JOGL Development / Re: security proble with the applet on: 2005-03-08 13:55:23
Thanks guys, using a .java.policy file in my home directory solved the problem. But my problem now is the image loader. I want to use a rather large texture (up to 5000x5000). I tried a tutorial but I got hit and miss results. Now I'm using the png loader from NeHe's lessons 06 port for jogl. It works fine for their image, but when I create an image of my own, either in Photoshop or in MS Paint the image won't load. Can someone shine a light on this?
16  Java Game APIs & Engines / JOGL Development / security proble with the applet on: 2005-03-07 20:32:32
Ok, I've recently posted about trying to create an applet.
I took a look at how I can create the applet in NetBeans 4.0.
Appletviewer reports the applet as loaded, but after a second or two I get this exception:

java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)
   at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
   at java.security.AccessController.checkPermission(AccessController.java:427)
   at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
   at sun.applet.AppletSecurity.checkAccess(AppletSecurity.java:159)
   at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:288)
   at java.lang.Thread.init(Thread.java:310)

I think this happens because I set up a thread to run somethings. How can I grant full access to my applet?
Weird thing is IE opens the applet, but doesn't do some things (doesn't load a texture it's supposed to. I read about a java.policy file something. How do I use this and does NetBeans understand it automatically? Thanks
17  Java Game APIs & Engines / JOGL Development / Re: problem with making an appletSo now I on: 2005-03-07 08:00:16
Thanks for the advice. I didn't know that the sdk actually install 2 jre's, one inside the SDK folder and the other in a jre folder of its own. So now, I'm getting a different kind of error, if someone can ellaborate:

java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM)
     at java.security.AccessControlContext.checkPermission(Unknown Source)
     at java.security.AccessController.checkPermission(Unknown Source)
     at java.lang.SecurityManager.checkPermission(Unknown Source)
etc. etc.

I guess I have to sign my applet or something? How do I do that? Thanks for the help and again, sorry for the silly questions, but I'm only studying java for a few weeks.
18  Java Game APIs & Engines / JOGL Development / problem with making an applet on: 2005-03-07 06:57:17
Hi to everyone. I'm trying to port my application to an applet. I did a basic application which works well as standalone. I can even start it from the command line so I suppose I've set up my classpath correctly. As a stand alone app I inherit from JFrame and have a public static void main method. To make it an applet I just changed the inheritance to JApplet, deleted the super call in the constructor and the setDefaultCloseOperation and added a public void init where I copied the contents of main:

pubic void init()
{
   final Main app = new Main();
     SwingUtilities.invokeLater(
         new Runnable() {
           public void run() {
               app.setVisible(true);
             }
        }
      );
}

But still the app refuses to run as an applet. Also, the .htm file, should be in the folder with the classes (they're inside a package) or on the previous folder? The error I get on the java console in the browser is class def not found for GLEventListener. Any ideas? Any tutorials as running opengl programs as applets?
19  Java Game APIs & Engines / JOGL Development / Native libraries needed? on: 2005-03-02 13:33:28
Hi to everyone! I'm starting to learn java for my work, so please bear with me. I'm not very familiar with the language yet!.
I'd like to ask, if I need to create a web service that has an opengl panel on it, do I need to install the native dll (or .so) in the client for it to function? Also, is there an automatic fallback mechanism, in case the client does not support OpenGL? Like fall back to swing to draw a bitmap? Or I'd have to do that myself? Thanks  Wink
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.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (19 views)
2014-09-24 16:12:06

Grunnt (44 views)
2014-09-23 14:38:19

radar3301 (27 views)
2014-09-21 23:33:17

BurntPizza (62 views)
2014-09-21 02:42:18

BurntPizza (32 views)
2014-09-21 01:30:30

moogie (39 views)
2014-09-21 00:26:15

UprightPath (50 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!