Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
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] 2
1  Java Game APIs & Engines / JOGL Development / Re: JOGL2 status on: 2009-06-05 08:49:43
thanks, I see that - will check it out.

Is there a timetabled official release date ?
2  Java Game APIs & Engines / JOGL Development / Re: getting a deadlock with a JOGL context on: 2009-06-01 12:49:32
version 1.3, from the current release build on the JOGL website,   

jogl-1.1.1-windows-i586.zip
   Draft    kbr on Thursday, May 22, 2008 at 11:54:58 PM          JSR-231 1.1.1 binaries for Windows/x86



Hadn't heard of JOGL 2 - where can I get the binaries from, is there a stable release build, and is it (hopefully) backward-compatible ?

Cheers,

Stu
3  Java Game APIs & Engines / JOGL Development / getting a deadlock with a JOGL context on: 2009-05-31 13:56:04
Hi,

I'm getting a bit of a funny deadlock issue with an application I'm building which uses JOGL together with Swing and AWT.

I have a class which extends Thread which is my repaint Thread.  It has an ArrayList of JFrames (including the frame with the JOGL canvas in it) and another ArrayList of classes extending from an extension of JFrame used for all my Swing/AWT frames.  There is a synchronized add() method to each arraylist, and the run() method periodically calls a synchronized private method which calls repaint() on all the panels and display() on the GL canvas (the rest of the run loop is not synchronized).  I'm not using an Animator class.

This all works fine until the user presses a button which causes the Event Dispatch Thread to call the add() method on the extended JFrames arraylist, when it deadlocks.  If I profile the app, I can see that it is the Event Dispatch Thread that is waiting on the monitor, and never seems to get into the add() method. 

Removing the 'synchronized' from either the add() method or the repaint block lets the programme run, but I've solved it a bit more robustly by wrapping the call to GLCanvas.display()  in a SwingUtilities.invokeLater(new Runnable(){}); block (ie call it from the Event Dispatch Thread after the event queue is cleared).

Just wondering if anyone can shed light on why this is doing it, and whether my solution is a good one ?  Does the GLCanvas.display() method keep the monitor on the object calling it somehow, even after it's returned ?

Cheers

4  Game Development / Performance Tuning / Re: Any optimisations on Math.log() and Math.exp() ? on: 2009-01-31 11:20:29
Hi there, thanks for the response.

Actually so far in the build, the speed of the programme is holding up very well, there's plenty of time left in each cycle, so I don't think calling the Math functions is causing me any performance problems.  I'll leave them in for now, for the accuracy they give.

Of course I might come back if they do start to be too intensive down the road.

Cheers
5  Game Development / Performance Tuning / Re: Any optimisations on Math.log() and Math.exp() ? on: 2009-01-17 21:07:01
yuk.

Could I use JNI into that C module, or is that just silly ?
6  Game Development / Performance Tuning / Any optimisations on Math.log() and Math.exp() ? on: 2009-01-17 20:00:38
Hi,

I'm writing a program which will need to call Math.log() and Math.exp() quite a bit, and knowing that these are pretty intensive functions, was wondering if anyone has written any accurate faster math optimisations of them ?

Also Math.sqrt(), I'm aware of some bitwise operation routines which are faster on some JVMs, but it seems more recent JVMs are pretty well optimised in Math.sqrt() already ?

Cheers
7  Java Game APIs & Engines / JOGL Development / Cg in an applet via JNLPAppletLauncher ? on: 2009-01-13 17:58:59
I've seen a few old posts on this from a couple of years ago, but I was wondering if the situation has changed...

I've written an applet that uses JOGL and Cg.  The applet deploys via JNLPAppletLauncher and runs properly on my laptop since it is able to find the pre-installed Cg dll's on the hard drive, but if I try to run the applet on another machine without Cg pre-installed, then the applet is unable to load Cg.  JOGL deploys properly on both machines (the applet defaults to not using Cg if it's not available).

The applet launcher obviously makes some kind of attempt to launch Cg here (edited log):
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
validateCertificates:
VALIDATE: jogl.dll
VALIDATE: jogl_awt.dll
VALIDATE: jogl_cg.dll
extractNativeLibs:
EXTRACT: jogl.dll(jogl)
EXTRACT: jogl_awt.dll(jogl_awt)
EXTRACT: jogl_cg.dll(jogl_cg)
validateCertificates:
VALIDATE: gluegen-rt.dll
extractNativeLibs:
EXTRACT: gluegen-rt.dll(gluegen-rt)
JNLPAppletLauncher.loadLibrary("jogl")
    loading: C:\DOCUME~1\Admin\LOCALS~1\Temp\jnlp-applet\jln6444612101995085350\jln5741450139073562519\jogl.dll
JNLPAppletLauncher.loadLibrary("jogl_awt")
    loading: C:\DOCUME~1\Admin\LOCALS~1\Temp\jnlp-applet\jln6444612101995085350\jln5741450139073562519\jogl_awt.dll
JNLPAppletLauncher.loadLibrary("cg")
JNLPAppletLauncher.loadLibrary("cgGL")
JNLPAppletLauncher.loadLibrary("jogl_cg")
    loading: C:\DOCUME~1\Admin\LOCALS~1\Temp\jnlp-applet\jln6444612101995085350\jln5741450139073562519\jogl_cg.dll
java.lang.UnsatisfiedLinkError: C:\Documents and Settings\Admin\Local Settings\Temp\jnlp-applet\jln6444612101995085350\jln5741450139073562519\jogl_cg.dll: Can't find dependent libraries


The dependent libraries it's missing are cg.dll and cggl.dll which, from further up in the log, look like they didn't load.

Is there a .jnlp file which can load all of the Cg dll's ?

The applet is here

8  Java Game APIs & Engines / JOGL Development / Re: question on textures, alpha values and lighting on: 2009-01-13 16:10:37
Finally got round to looking at this - that was pretty useful, thank very much.

had a good play around -  gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_COMBINE_RGB, GL.GL_ADD); was the closest to what I wanted, since it could display the stickers in their proper colour, but add on the shininess on top. 

I still couldn't get the stickers to have the right diffuse material properties that I wanted though.

Instead I've written a pixel shader program in Cg to do it - it reads the incoming texel alpha value and sets the material property differently depending on whether the alpha is 0 or 1.

It works, but I have a few Cg problems though, which I've posted on the nVidea site (here and here if there are any Cg experts who fancy a look)
9  Java Game APIs & Engines / JOGL Development / Re: question on textures, alpha values and lighting on: 2008-12-21 10:57:52
thanks, I'll check that out (I'm about to go on holiday though, so won't be for a couple of weeks  Grin )
10  Java Game APIs & Engines / JOGL Development / Re: question on textures, alpha values and lighting on: 2008-12-18 19:04:51
yeah.  I presume I'll need to draw a separate quad for each sticker so that I can give it a separate material, which a bit of a pain with the way it's written, but maybe if I'm bored I'll do it
11  Java Game APIs & Engines / JOGL Development / Re: question on textures, alpha values and lighting on: 2008-12-18 14:57:10
nah, tried all the alternatives:

- Modulate - the gaps between stickers are transparent, and the stickers themselves still have their colour but have applied material on top (so appear black most of the time, but show a little bit of their colour if you can angle it just right to get some reflected specular light)

- Replace - gaps are transparent, stickers just show their own colour (ie can only see the texture), no lighting effect

- Blend - same as Modulate but the specular colour reflected is (1,1,1)-sticker colour

- no call to textureEnv - same as Modulate

I've tried it with an alternative texture, where the non-sticker parts are black instead of alpha=0 - with Modulate, the gaps between the stickers render properly, but as above, the stickers don't, they are black most of the time, and show colour only when reflecting specular

I guess what I need is for the alpha=0 parts of the texture to have one applied material, and the alpha=1 parts to have a different applied material - is that even possible ?

Cheers,

Stu

12  Java Game APIs & Engines / JOGL Development / question on textures, alpha values and lighting on: 2008-12-18 12:44:06
Hi,

I'm continuing to work on my Rubik's cube JOGL-learning project, and am putting in lighting to make it look more interesting.

In order to get specular highlights off the black edges of the cubelets (they are slightly rounded cubes), I have given each cubelet the following material properties:

Kd 0.039216 0.039216 0.039216
Ka 0.000000 0.000000 0.000000
Ks 0.850000 0.850000 0.850000
Ke 0.000000 0.000000 0.000000
Ns 30

I then bind a texture over the top of them - the texture has solid blocks of colour with rounded edges for the stickers, and alpha=0 areas elsewhere.  I bind them together like this:

        gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA);
        gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_DECAL);

I am lighting the scene with a diffuse and specular light above, to the left and behind the camera and a secondary light above right and behind.

It looks like this, which I'm quite pleased with:



My question though is this:

How can I get the different faces of the cube to render in different shades as well, depending on their angle to the diffuse lights, eg in this example the blue face should be rendering darker.  If I turn the texturing off but leave everything else the same, the different faces do render in different shades properly.

I guess I'm asking how can I shade the texture colours ?


(a lot of work for rendering a cheap plastic toy !)
13  Java Game APIs & Engines / JOGL Development / Re: Mouse pointer flickering using JOGL on: 2008-12-11 22:12:30
Maybe I should just disable the custom cursor for OSX

which leads me to another problem, trying to find out if it's OSX or not.

Using a statement like

1  
if(System.getProperty("mrj.version")!=null)isMacOS=true;


gives a security access violation

1  
java.security.AccessControlException: access denied (java.util.PropertyPermission mrj.version read)


as does System.getenv().  It'll be because the applet itself is an unsigned sub-applet running within a signed jnlpappletlauncher applet. 

Seems silly to restrict the info on the operating system, since I could easily have the applet send an http request to a cgi script on my server, which can read the os, and could then send something back - but that seems to be rather overkill just for setting a cursor...

Any bright ideas how I can check the OS from within my applet ?


<sound of head repeatedly hitting desk>


14  Java Game APIs & Engines / JOGL Development / Re: Mouse pointer flickering using JOGL on: 2008-12-11 20:57:49
gah  Cry

Maybe I should just disable the custom cursor for OSX


Edit:

By the way - just a random thought from me on the mutiple tab problem for a JOGL applet (and I might be talking total garbage, so feel free to ignore) -

Isn't the GL object you get from calling GLAutoDrawable.getGL() a single-instance object, so if you have the same applet running in two tabs of the same browser, then you have one jvm, two instances of the applet class, both messing with the state of a single instance of the GL, so everything screws up ?

or... not ?



15  Java Game APIs & Engines / JOGL Development / Re: Mouse pointer flickering using JOGL on: 2008-12-11 15:54:18
ahh - you're on Mac OSX...  I couldn't reproduce the problems with Safari on Windows.

I guess the cursor reappearing is the os overriding my setting of the cursor to invisible when there's a mouse event.  I've uploaded a work-around which will re-load the invisible cursor after every mouse button event - hopefully that fixes it ?

It seems there are known problems with JOGL in Applets under OSX, discussed here.  Out of interest are you able to view these JOGL applets (not mine) without the same problems ?



Edit:  just googled the Android thing - sounds like hard work - will do it if someone wants to pay me Wink

16  Java Game APIs & Engines / JOGL Development / Re: Mouse pointer flickering using JOGL on: 2008-12-11 11:24:27
thanks for the feedback Peter,

Yeah, actually my code for trapping the mouse events to determine whether or not to draw the cursor was a little lazy, and I'd noticed a similar related bug myself last night.  Have tightened it up now, so hopefully should look  bit better ?

Regarding the two cursor problem - that may be due to supported cursor sizes in Safari, so I've put in checking for the getBestCursorSize(), and also made my invisible cursor gif a 16x16 rather than 1x1 now, so maybe that helps ?


Don't like the sounds of the CPU maxed out though - do you have any more details of what happened there ?


Not too concerned about the multiple tab problem - anyone who's not testing the game, but has a rubik's cube open in more than one tab deserves all they get  Grin 

I have had similar problems with other applets I've written in the past though - I'm guessing it's to do with one jvm with multiple instances of the applet all accessing the same static and single-instance variables.


Cheers,

Stu



17  Java Game APIs & Engines / JOGL Development / Re: Mouse pointer flickering using JOGL on: 2008-12-10 21:38:00
fixed it - now has the cursors as textured quads, - no flickering and now the correct size

had a nightmare getting a texture with black, white and transparent areas to render onto a transparent quad and display everything correctly, but it does now

enjoy:

http://www.stupey.com/Rubik


18  Java Game APIs & Engines / JOGL Development / Re: Mouse pointer flickering using JOGL on: 2008-12-10 11:26:55
I've got cursor flickering/wrong size on two machines, both Firefox and IE, in XP.  I guess it's to do with specific graphics cards - mine are probably rubbish


When you say you're using custum cursors, are you creating textures of the cursor image and rendering it with jogl, or are you using Java's cursor support?

Yeah - was thinking that.  I'm using the standard Java cursor support at the moment, setCursor() and createCustomCursor(), but I will have a go at drawing a textured quad for a cursor instead and making the standard cursor invisible, that should at least fix the flickering, and sizing if I can get i right.  Bear with me though, I'm a JOGL noob.

Couldn't reproduce the applet showing on multiple FF tabs error, but have fixed a couple of things to do with navigating away and back to the applet now though.

19  Java Game APIs & Engines / JOGL Development / Re: Mouse pointer flickering using JOGL on: 2008-12-09 21:51:12
here's the programme to show you what I mean, it's a Rubik's Cube running as an applet:

http://www.stupey.com/Rubik

Ignore the contents on the webpage round it, that's all WIP.

drag the mouse or use the arrow keys to spin the cube, click/right click on a face to spin it clockwise/anti-clockwise

J key jumbles it, ESC peels all the stickers off and puts it back as new.

See how the cursors flicker and are much too big ?  They are direct grabs of regular cursors, and so JOGL is growing them for some reason

20  Java Game APIs & Engines / JOGL Development / Mouse pointer flickering using JOGL on: 2008-12-09 09:46:53
Hi.

I'm writing a simple game as a learning project for using JOGL, and have a problem with the mouse pointer - when the pointer is over the canvas, it flickers.  It looks like it's either only being drawn on one of the page buffers, or is only being drawn when it moves, or something like that.

I do want to use the pointer in the game, and want to use the standard pointers (the pointer and the hand) rather than create a custom pointer.

Everything else is working fine - it draws beautifully, recognises the mouse and keyboard events etc.

How can I stop the flickering ?

Cheers


Edit: just tried it with custom cursors instead - I get the same flickering, but also the cursors are then drawn noticeably larger than actual size


21  Games Center / Showcase / Re: ApoStarz and ApoPrism on: 2008-11-12 10:25:32
yep, that's better.

Had my 6 and 7 year-old kids playing it yesterday evening, they loved it !
22  Games Center / Showcase / Re: ApoStarz and ApoPrism on: 2008-11-10 15:49:01
actually I did think the hint gave too much away - how about it tells you of only one misplaced object and where it should be, per hint, and only say 3 hints per level ?
23  Games Center / WIP games, tools & toy projects / Re: Battlezone !! - need Beta testing please ! on: 2008-11-10 12:37:23
Finally got it working in an applet, here:

http://www.stupey.com/Battlezone/

The webstart and download links are on there too, plus links to my other games.


The Hi-Score table shared by the applet and webstart is a global one, so your scores will be saved for the rest of the world to try to beat - get on there quick before someone spanks it out of sight.

(The download app doesn't access the global hiscore, since it's a competition build, and rules say a) executable and b) no internet connectivity)

Enjoy

24  Games Center / Showcase / Re: ApoStarz and ApoPrism on: 2008-11-10 09:35:37
I like the prism one, managed to waste 2 hours of family time yesterday afternoon on it !
25  Discussions / General Discussions / Re: having JPanel in a JApplet problems on: 2008-11-08 12:53:27
sussed my problem - I'd got a line somewhere in the Main class in the init of the applet where I'd set JApplet applet=new Main()  and was then calling Main.applet.repaint()  so it was calling repaint on some random instantiation of the applet class that wasn't the applet on the screen.

changing that first line to JApplet applet=this; fixes it perfectly.

Onto double-buffering now, it looks horrible at the moment !
26  Discussions / General Discussions / Re: having JPanel in a JApplet problems on: 2008-11-08 12:19:47
hmm, you're absolutely right  !

Funny thing though, I'd put in a println statement in the while loop of the run() method, and that prints whether you use start() or run(), but if I put the same println in the paint method of the panel, then that only gets called with start()

Anyway, sadly that's not the cause of my problem in my game, I was using start() there anyway, and I know the game thread is running there - need to do some more thinking

Thanks though   Grin
27  Games Center / WIP games, tools & toy projects / Re: Battlezone !! - need Beta testing please ! on: 2008-11-08 11:44:38
Thanks for the great comments, chaps !!



Can you play the game in a double joystick configuration?

Absolutely you could, the key layouts are supposed to emulate that, but...  ermm...  I don't have two joysticks to program it with !
28  Discussions / General Discussions / having JPanel in a JApplet problems on: 2008-11-07 19:30:01
Can someone please help me out here - I'm obviously doing something stupid, but can't think what and am going round in circles.

This is a simple applet (actually more of a craplet) that should show a red screen, but doesn't.  It's a simplified version of something bigger that equally doesn't work.

The applet class:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
import javax.swing.*;
import java.awt.*;

public class MyApplet extends JApplet implements Runnable {
    MyPanel myPanel;
   
    public void init(){
        myPanel=new MyPanel();
        this.getContentPane().add(myPanel);
        new Thread(this).run();
    }
   
    public void run(){
        while(true){
            myPanel.repaint();
            try{Thread.sleep(50);}catch(Exception e){}
        }
    }
   
}


and the panel class:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
import java.awt.*;
import javax.swing.*;

public class MyPanel extends JPanel {

    public void paint(Graphics g){
        Graphics2D g2d=(Graphics2D)g;
        g2d.setColor(Color.RED);
        g2d.fillRect(0, 0, this.getWidth(), this.getHeight());
    }
}



Any ideas ?

Thanks
29  Games Center / WIP games, tools & toy projects / Re: Battlezone !! - need Beta testing please ! on: 2008-11-07 14:28:22
here's a webstart link:

http://www.stupey.com/Battlezone/launch.jnlp

30  Games Center / WIP games, tools & toy projects / Re: Battlezone !! - need Beta testing please ! on: 2008-11-05 17:56:46
haha, thanks very much, I'm blushing.

Not played around with JNLP before, but I'll give it a shot when I get a chance.  I have a couple of previous games as applets (see sig), so not sure why I'm struggling with this one, but anyway, I'll get something sussed soon.
Pages: [1] 2
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (53 views)
2014-04-15 18:08:23

BurntPizza (51 views)
2014-04-15 03:46:01

UprightPath (65 views)
2014-04-14 17:39:50

UprightPath (48 views)
2014-04-14 17:35:47

Porlus (65 views)
2014-04-14 15:48:38

tom_mai78101 (89 views)
2014-04-10 04:04:31

BurntPizza (149 views)
2014-04-08 23:06:04

tom_mai78101 (245 views)
2014-04-05 13:34:39

trollwarrior1 (203 views)
2014-04-04 12:06:45

CJLetsGame (210 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!