Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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 / Java 2D / Re: Graphics2D / BufferStrategy / Swing mess on: 2005-08-19 06:58:14
Are you disabling autopaint of the component?

Not that I know of.
2  Java Game APIs & Engines / JOGL Development / Re: Dsun.java2d.noddraw=true on: 2005-08-17 22:11:50
That got it, thanks. I was shying away from setProperty() because when I tried to use it for other things (java.library.path for JOGL) it didn't work out.
3  Java Game APIs & Engines / Java 2D / Re: Graphics2D / BufferStrategy / Swing mess on: 2005-08-17 06:52:20
OK. New strategy. I found that I can build a BufferStrategy from a Canvas, so I replaced the internal JPanel with a Canvas. Now I am using the BufferedStrategy with a backbuffer, on the Canvas. Doing this sped me up significantly and eliminated the offset for the titlebar, while still letting me use my backbuffer to retain my scaling and scrolling functionality.

All that's left now is getting Swing to render right. I can get it to draw by calling my Swing components' paint() and passing in the buffer strategy's getDrawGraphics(), but the component doesn't register clicks. I think it's because I am forcibly drawing them there, as opposed to them natively being there. I tried putting the Swing and the Canvas in the JFrame's getLayeredPane() with the Swing higher than the Canvas. Doing this still doesn't render the swing (it may be overdrawn by my Canvas somehow) unless I call the swing's paint(), at which point it still doesn't see clicks.
4  Java Game APIs & Engines / Java 2D / Graphics2D / BufferStrategy / Swing mess on: 2005-08-17 06:22:57
Hey, guys. Having a really hairy quandary here that perhaps you could help me with.

I'm working on a 2D adventure game engine, and doing the following:

1. Rendering to an offscreen image, then getting the Graphics2D of a JPanel inside of / same size as my JFrame, rendering the image to the panel.
2. That render performs a scale operation as well, so that my entire scene fits in the window regardless of the window size.
3. Trying to render a Swing component or two over top of this panel. They should stay in the same position onscreen, even when the underlying panel scrolls to reveal more of the game scene.
4. Manually repainting the object using a timer.

Here's the issues I have:

1. Rendering Swing over the JPanel causes the Swing to flicker badly.
I tried using a JLayeredPane to help, it didn't. -Dsun.java2d.noddraw and the other posted tweaks didn't help either. The only solution I was able to find is to render the swing into the same graphics as my game objects (thus, onto the backbuffer) and then drawing it all at once. Now it doesn't flicker as much, but the Swing rendering doesn't look quite right and the game doesn't acknowledge that I've clicked on the Swing object.
 
2. Rendering performance is awful and seems to be fill-bound, as it gets significantly worse as the window gets bigger.

I recently tried switching the solution to a BufferedStrategy. I gained a ton of framerate by so doing, but the Swing was still an issue. Additionally, if I render to the JFrame's Graphics2D object, in windowed (decorated) mode, the game seems to count the titlebar as part of the window and cost me 30 px of my scene's image. Finally, without an Image object in hand, I can't use the drawImage function that permits me to scale a rectangle of an image into another rectangle, which I have been using to get the window the appropriate size.

I also looked at using a RepaintManager but didn't see much luck there either.

Here's the solution I need; maybe one of you can point me in the right direction.

1. My scene is often bigger than the window, so I need to be able to scroll. Right now I am using a Rectangle as a "viewport", copying out of the back buffer image (which is the size of the entire screen) only what is needed.

2. I need to be able to render Swing components on top of the still-refreshing Graphics2D work, either on a JPanel or in the JFrame itself without losing the pixels on the top of the window to the titlebar.

3. I need to be able to scale the final render so that it fits in the window regardless of the window's size (or full screen). Optimally, the Swing components would scale also, but this is not crucial. They do, however, need to stay in place while the background (the game's graphics) scroll.

4. I need rendering performance to not totally suck.


Can anyone help me with this conundrum?
5  Game Development / Newbie & Debugging Questions / Re: Doublebuffering on: 2005-08-17 06:02:53
(3) There are 2 alternate open source scene-graph projects in the works that play ina similar space as Java3D but are being developed with a bit more of a game-focus.  Those are Xith and a currently unnamed project of Shawn Kendall

OMG Shawn Kendall.. Had him as a teacher once. Used to rag on him about Java; now I'm doing it too. LOL.
6  Java Game APIs & Engines / JOGL Development / Re: Dsun.java2d.noddraw=true on: 2005-08-17 04:42:54
Is there a way to specify -Dsun.java2d.noddraw=true in code, rather than on the command line? I'm trying to make my app as easy to start as possible by eliminating all these nasty command line switches.
7  Java Game APIs & Engines / JOGL Development / Re: Animator performance issue? on: 2005-08-09 23:00:52
The Animator currently consumes 100% of the CPU. If you have anything else going on in your application then the Animator will swamp it. This will be fixed in the JSR-231 APIs and is in progress. You could try using the FPSAnimator from this thread. Something like that will be included in the JSR-231 rewrite of the Animator.


.... Wow.
8  Java Game APIs & Engines / JOGL Development / Animator performance issue? on: 2005-08-09 18:39:26
Hey, all.

I have some very simple 2D rendering code running, with a few moving images I'm doing with glDrawPixels. I had set rendering on its own timer through my event scheduling package. I then decided to take advantage of the Animator class. Doing nothing but removing the draw from the timer and adding an Animator, my performance falls by almost 60%.

Are there any "common suggestions", or is it necessary to start pasting code?
9  Java Game APIs & Engines / JOGL Development / Re: Suggestion / Call to Arms: JOGL Bridge Utilities on: 2005-08-08 18:41:01
Definitely. There's a big difference between, "this toolkit gives you a game engine" and "this toolkit gives you a general purpose window you can draw stuff in." It's almost 2006. There's no reason we should still be writing code to make a window go full screen on Alt-Enter.
10  Java Game APIs & Engines / JOGL Development / Re: Coordinate flipping issue on: 2005-08-08 04:15:17
Hmm. Issue. Images draw right side up, but fonts probably won't.

Any suggestions?
11  Java Game APIs & Engines / JOGL Development / Suggestion / Call to Arms: JOGL Bridge Utilities on: 2005-08-08 04:13:47

You know, after looking at the demos and seeing the amount of code that floats around these forums, I got to thinking.

There are only so many ways to make a fullscreen window. There are only so many ways to handle the problem where AWT and OpenGL have opposite direction Y values. Everybody could use a feature to extract the current buffer to a java.awt.Image file for saving as a screenshot. The dynamic lib loader discussed on another thread is another great example. It's obvious people have written these kinds of things. And while JOGL is intended as a straight binding, it seems to me that there is no reason everybody should have to implement these basic functions of a game window.

I'm sure people will reply and say, there's LWJGL and all of those things, and they'd be absolutely right. But, those are large, overarching frameworks for a certain kind of task; game development and so forth. What I'm wondering is if Ken and the JOGL gang could accept submissions on this forum for just incredibly useful, GENERAL PURPOSE functionality that can be seen as needed in 75% or more of JOGL apps. Take the best ones, focusing on the relationship between AWT/Swing and JOGL, and create a few additional classes for the utils package.. Perhaps a subclass of JFrame that incorporates a GLCanvas or GLJpanel and includes such user methods as toFullScreen(), scaleToFitFrame2D(), and getBackBufferAsImage()? How about a GLImage class that wraps the byte buffers we use to render 2D graphics? Again, we're not looking for "HalfYourProject.class"... Just some basic, everybody-needs-it functionality.

Doing it this way, asking for tested, proven submissions from the forum, is also a benefit because you get the work done without taking your time from the new JSR. Additionally, it gives forum members, who can't get Developer status on JOGL because the team is kept very small, a chance to contribute to this great project, get a little kudos for it, and feel great. I know of a few small things I'd submit, and I'd love to say some of my code was being distributed with JOGL.

Anybody have any suggestions / comments / TESTED and LICENSE-FRIENDLY submissions?
12  Java Game APIs & Engines / JOGL Development / Re: Dynamic loading of the .DLLs - hitting a snag on: 2005-08-04 23:15:55
Sure, as soon as my tester with the Mac gets online Smiley
13  Java Game APIs & Engines / JOGL Development / Re: Dynamic loading of the .DLLs - hitting a snag on: 2005-08-04 18:42:19
Ken, we're still having trouble, with the code posted above, getting jawt loaded on OS X. Any more suggestions from your bag of tricks?
14  Java Game APIs & Engines / JOGL Development / Re: Dynamic loading of the .DLLs - hitting a snag on: 2005-08-04 14:41:55
I don't know if that solution would be any better than just shipping the natives unpacked and I guess that java doesn't allow you to mount a virtual filesystem in RAM memory either ?

It would still enable them to make a function to load the libs dynamically for the right os without the user needing to use -Djava.library.path.

Incidentally, does anyone know of a way to do the noddraw workaround in code?
15  Java Game APIs & Engines / JOGL Development / Re: Coordinate flipping issue on: 2005-08-04 04:19:35
OK. Got it solved! I had to invert the coordinates in the gluOrtho2D call, then change around the way I was loading images (it was inverting to deal with the AWT/OpenGL coordinate discrepancy already), and then needed to display the images at x, y + height in order to have the image's 0,0 be upper left instead of lower right. So now AWT, JOGL and my individual objects are all in the same page about it, and life is good! No longer do my objects' bounding boxes zoom off one way and the object another! There was much rejoicing!
16  Java Game APIs & Engines / JOGL Development / Re: Dynamic loading of the .DLLs - hitting a snag on: 2005-08-04 04:16:29
How's about just a static call, passing in the path to your lib directory?
17  Java Game APIs & Engines / JOGL Development / Re: Coordinate flipping issue on: 2005-08-03 16:50:47
That's what I wanted to hear. Wouldn't that make images draw upside down, though?
18  Java Game APIs & Engines / JOGL Development / Easy 2D scaling solution? on: 2005-08-03 05:17:09

Forgive all my questions; I'm way, way rusty with OpenGL.

Working on a 2D project, I'm finding a lot of issue with keeping things in the proper scale as the window resizes. It seems to be that the reshape() method of GLEventListener should be able to keep everything in scale for me, and there's some crucial GL call I'm missing or something. Does anyone know of a simple way to have reshape() scale my view without manually scaling every object?
19  Java Game APIs & Engines / JOGL Development / Re: Coordinate flipping issue on: 2005-08-03 05:13:50
I figured that, but I anticipate there being other issues down the line, which is why I was hoping somebody had a silver bullet for me Smiley
20  Java Game APIs & Engines / JOGL Development / Coordinate flipping issue on: 2005-08-03 04:37:06

I'm working on a 2D game, and having some trouble with clicking. I'm using java.awt.Polygon for the boundaries on the click areas, so they can be arbitrary shapes. However, because JOGL's 0,0 is in the bottom left and AWT's is top left, my click boundary and my image are on opposite sides of the screen. Is there a way to change one coordinate set or the other so that they match?
21  Java Game APIs & Engines / Java Sound & OpenAL / Re: Considering using JOAL on: 2005-08-03 03:15:00
Fair 'nuff. Just trying to be helpful.

I think I have it ported over, anyhow.
22  Java Game APIs & Engines / Java Sound & OpenAL / Re: Considering using JOAL on: 2005-08-02 22:37:44
Hrmm.

Really, it seems like the biggest problem is the java.nio. buffers... LW uses them, JOAL uses straight int arrays (modeling the straight C syntax).

Maybe I can figure it out if I dig thru the buffer javadocs; who knows, there might be a toIntArray I coud use to convert the stuff prior to the call.

Would you mind me posting the class to the forum, in case somebody else would be able to help? Also, would you be interested in distributing a JOAL version of your player if I can generate one?
23  Java Game APIs & Engines / JOGL Development / Re: Dynamic loading of the .DLLs - hitting a snag on: 2005-08-02 19:43:56
It's just a bunch of static utilities I wrote. Nothing major.

Here's a version of the code, which now works, with the Tools calls replaced with straight java:

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  
/** Static initialization  - load libraries */
      /** Ensure we load GL on startup. This is a replacement for the command-line switches
     *  -Djava.library.path=.
     *
     *  @param bLoadCg if 'true', load Cg libraries
     */

    public static void loadOpenGL(boolean bLoadCg)
    {        
        // workaround to allow our loader to do its job
       // see http://192.18.37.44/forums/index.php?topic=10262.0;topicseen
       net.java.games.jogl.impl.NativeLibLoader.disableLoading();
       
        // Manually load AWT to work around the problem with error boxes coming up claiming it's not found.
       // Apparently AWT has to be loaded -before- jogl's .dll files or all Hell breaks loose.
       java.awt.Toolkit.getDefaultToolkit();
        System.loadLibrary("jawt");        
       
        // Now, load the .dll/.so files for the OpenGL C bindings
       String strOS = System.getProperty("os.name");
        String strJOGL = System.getProperty("user.dir") + System.getProperty("file.separator") + "lib" +
                System.getProperty("file.separator");
       
        if (strOS.startsWith("Windows"))
        {                        
            System.load(strJOGL + "jogl.dll");            
           
            if (bLoadCg)
                System.load(strJOGL + "jogl_cg.dll");                
        }        
        if (strOS.startsWith("Mac OS"))
        {
              System.load(strJOGL + "libjogl.jnlib");
              if (bLoadCg)
                System.load(strJOGL + "libjogl_cg.jnlib");        
        }                
        if (strOS.startsWith("Linux"))
        {
                System.load(strJOGL + "libjogl.so");
                if (bLoadCg)
                    System.load(strJOGL + "libjogl_cg.so");
        }
        if (strOS.startsWith("Solaris"))
        {
               String strArch = System.getProperty("os.arch");
               if (strArch.equalsIgnoreCase("sparc"))
               {
                   System.load(strJOGL + "libjogl_solsparc.so");
               }
               if (strArch.equalsIgnoreCase("x86"))
               {
                   System.load(strJOGL + "libjogl_solx86.so");
               }
        }
    }
 
24  Java Game APIs & Engines / JOGL Development / Re: Dynamic loading of the .DLLs - hitting a snag on: 2005-08-02 19:40:05
Consider it done:

https://jogl.dev.java.net/issues/show_bug.cgi?id=171
https://jogl.dev.java.net/issues/show_bug.cgi?id=172

25  Java Game APIs & Engines / Java Sound & OpenAL / Re: Considering using JOAL on: 2005-08-02 17:42:54
Tom, I downloaded your Ogg player and stuff, and love it. I'd like to use it in a game I'm working on where the sounds will primarily be ogg. However, we're using JOAL instead of LWJGL.

What are the chances I could ask you to give me a hand in making a JOAL version of OggPlayer.java? The input stream class is fine; it doesn't rely on OpenAL at all.
26  Discussions / General Discussions / Re: Looking for people, that are interested in wrapping Direct3D for Java on: 2005-08-02 17:32:42

I'm not sure I agree with that.. Don't have the LATEST OpenGL, perhaps...

That notwithstanding, the Dx-emulating wrapper could be done over something other than JOGL, as I stated...
27  Java Game APIs & Engines / JOGL Development / Re: Dynamic loading of the .DLLs - hitting a snag on: 2005-08-02 17:30:57
That did it! Once I get the .jar loading situation handled with a classloader, I'm all set.

You really are a 'ninja', Ken. Thanks much.
28  Discussions / General Discussions / Re: Looking for people, that are interested in wrapping Direct3D for Java on: 2005-08-02 16:39:53
What about going the other way, and writing a "port" of DirectX? It would be a lot more work, but a lot more useful to people familiar with DX. By that, I mean generate the same class names as DX, with the same function calls, and have the work inside done by something lower-level like J3D (or perhaps even JOGL)?

In this way users of Dx could bring their knowledge to bear in Java projects to similar, but xplatform, results.
29  Java Game APIs & Engines / JOGL Development / Re: Playing a movie? on: 2005-08-02 16:21:46
I found a free player that builds over jVorbis that I really like, but it's set up for LWJGL. I posted the code to another thread in hopes someone could help me get it translated to JOAL.

I may be doing other stuff with JOAL, so I'd really like to have it running, and use this player I found.

As far as video files - do you think JMF is the best solution there?
30  Java Game APIs & Engines / JOGL Development / Re: Dynamic loading of the .DLLs - hitting a snag on: 2005-08-02 08:51:53
OK. Ignoring the jar for a minute (I can handle the classloader later...), I'm getting UnsatisfiedLinks on jogl.dll when I try to dynamically load it, now. Here's the code:

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  
  // this is called from a static initializer block in the class where main() is 
 public static void loadOpenGL()
    {        
        // Manually load AWT to work around the problem with error boxes coming up claiming it's not found.
       // Apparently AWT has to be loaded -before- jogl's .dll files or all Hell breaks loose.
       java.awt.Toolkit.getDefaultToolkit();
        System.loadLibrary("jawt");                        
         
        // Now, load the .dll/.so files for the OpenGL C bindings
       String strOS = Tools.GetOS();
        String strJOGL = Tools.GetRelativePath("lib") + Tools.GetFileSeparator();                
       
        if (strOS.startsWith("Windows"))
        {                        
            System.load(strJOGL + "jogl.dll");            
           
            if (bLoadCg)
                System.load(strJOGL + "jogl_cg.dll");                
        }        
        if (strOS.startsWith("Mac OS"))
        {
              System.load(strJOGL + "libjogl.jnlib");
              if (bLoadCg)
                System.load(strJOGL + "libjogl_cg.jnlib");        
        }                
        if (strOS.startsWith("Linux"))
        {
                System.load(strJOGL + "libjogl.so");
                if (bLoadCg)
                    System.load(strJOGL + "libjogl_cg.so");
        }
        if (strOS.startsWith("Solaris"))
        {
               String strArch = System.getProperty("os.arch");
               if (strArch.equalsIgnoreCase("sparc"))
               {
                   System.load(strJOGL + "libjogl_solsparc.so");
               }
               if (strArch.equalsIgnoreCase("x86"))
               {
                   System.load(strJOGL + "libjogl_solx86.so");
               }
        }
    }


And this is the exception trace I get:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.loadLibrary0(Unknown Source)
        at java.lang.System.loadLibrary(Unknown Source)
        at net.java.games.jogl.impl.NativeLibLoader$1.run(NativeLibLoader.java:72)
        at java.security.AccessController.doPrivileged(Native Method)
        at net.java.games.jogl.impl.NativeLibLoader.load(NativeLibLoader.java:58)
        at net.java.games.jogl.impl.GLContext.<clinit>(GLContext.java:52)
        at net.java.games.jogl.impl.windows.WindowsGLContextFactory.createGLContext(WindowsGLContextFactory.java:147)
        at net.java.games.jogl.GLCanvas.<init>(GLCanvas.java:72)
        at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:150)
        at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:118)
        at net.java.games.jogl.GLDrawableFactory.createGLCanvas(GLDrawableFactory.java:85)
        at org.slage.ui.GameFrame.<init>(GameFrame.java:84)
        at org.slage.SLAGE.initialize(SLAGE.java:94)
        at org.slage.tests.ImageTest.main(ImageTest.java:41)


All I want to do is get the dlls and jars loading in such a way as to prevent a lot of command line switches. It seems that I shouldn't be the first person to have wanted to do this - what am I missing here?
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.

ctomni231 (32 views)
2014-07-18 06:55:21

Zero Volt (28 views)
2014-07-17 23:47:54

danieldean (24 views)
2014-07-17 23:41:23

MustardPeter (25 views)
2014-07-16 23:30:00

Cero (40 views)
2014-07-16 00:42:17

Riven (42 views)
2014-07-14 18:02:53

OpenGLShaders (29 views)
2014-07-14 16:23:47

Riven (29 views)
2014-07-14 11:51:35

quew8 (26 views)
2014-07-13 13:57:52

SHC (63 views)
2014-07-12 17:50:04
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!