Doublebuffering

Hi everyone! First off, I’m completely new here, so please be kind. :wink:

I’ve recently moved to Java for my hobbyist game coding, but I’m apparently learning rather slowly. My first big question is about activating a double-buffer in my app. I’m using swing with JFrame and JPanel, and Java2D to extend JPanel with Gaphics2D objects. (I’ve actually succeeded already in antialiasing everything!) I’ve heard rumor that swing automatically implements double-buffering…is this true? I definitely don’t notice as much flickering in a JPanel, but it does seem to happen once in a while. Is there something special I still have to do to activate it?

Any other “newbie” advice for game programmers would be welcome as well. Thanks! ;D

Swing does double buffering automajically, but its not very handy for games. You’ll want to use BufferStratergy instead to get a double/triple buffer that you can control yourself. Should be plenty of examples of people using it in the forum…

I don’t mean to sound ungrateful or anything, but I just spent the last couple of hours scouring this board in search of double-buffering info…my head is swimming now. ???

There seems to be so much info out there, and everyone seems to have a different way of doing it. So here’s just a few more questions:

  1. What’s better for making games? Jpanel? Panel? Canvas? Something else?

  2. What’s the best way to implement buffering in that method? BufferStrategy? Is there a good tutorial on this somewhere?

  3. I seem to keep running into old information pertaining to older releases of Java. Is there a good place to get recent recommendations on game coding in Java?

and lastly:
4) I’m REALLY confused on the 3D front…Sun seems to be coding apps in 3D (like their new 3D desktop they recently showed off), but I’ve heard they dropped Java3D. So what are they officially using? Is something going to be built into Java 1.5?

I’m really sorry for the newbie issues here. I’m incredibly interested in the cross-platform capabilities of Java, and so I’m trying to learn it…there’s just so many API’s and methods to learn that I’m starting to fall apart at the cerebral cortex.

I just use awt, though many people wouldn’t suggest it. AWT seems very intuitive to me, you might want to try it.

Okay, lost of questions…

IF you are in a Java2 envrionment I would strongly suggest either the FullScreen/BufferStrategy API (which doesnt have to be full screen despite the name) OR using an OGL binding and doing “2D with 3D” like Cas did for AlienFlux.

OTOH if you are coding Applets for deployment today then you may need to deal with MSFTS shitty MSVM in which case you are in an AWT world. It can still be done, some of my earliest Java stuff was done that way and I got okay results. Its just more painful. The guys here who do it regularly can help you there.

On the 3D front let me clear up what I can:

(1) Java3D is not abandoned. It is however in “stasis” with no new development being done right now. I don’t have more I can say about that right now, when it stops living the life of Schroedinger’s Cat I’ll let you guys know the outcome. There ARE a great many Universities and the like still doing work in it so it would be pretty hard to just kill outright. (In fact the mars rover browser you can download from NASA is a Java3D app and they are using a version of the same App inside NASA for real mission work.)

(2) We in the GTG felt it was important to cover the basics that hadn’t been covered til now. Ergo we focused on an OGL binding.
We (the Sun Game Technology Group) are supporting JOGL. Another alternative is Cas’s LWGL. Either have their strong points.

(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

Are any of these 3D APIs going to be officially supported in the next release of Java? I’m really concerned about keeping with the “Sun standard” (if there is such a thing). I also like making sure that people who use my programs have minimal effort in installing them. If I use JOGL for instance, will anyone running my app have to go out, find the JOGL binaries and install them?

[quote]Are any of these 3D APIs going to be officially supported in the next release of Java? I’m really concerned about keeping with the “Sun standard” (if there is such a thing).
[/quote]
Current guesstimates are no, but then again thats not really too relevant. Any kind of mythical “Sun standard” is also pretty irrelevant. Java3D doesn’t work on Mac, Jogl is still less reliable than LWJGL - in short being “official” doesn’t guantee you it actually being the right thing to use.

[quote]I also like making sure that people who use my programs have minimal effort in installing them. If I use JOGL for instance, will anyone running my app have to go out, find the JOGL binaries and install them?
[/quote]
S-Type (see sig) uses Jogl, yet by using webstart the user doesn’t have to lift a finger - platform dependant files get sucked down automajically. And theres no reason why you can’t use webstart and LWJGL to do the same (although i think Java3D + webstart requires all sorts of weird voodoo).

[quote]Java3D doesn’t work on Mac,
[/quote]
Um, it sure does.
Java3D and Java Advanced Imaging were released for Mac OS 10.3 several weeks ago.

OMG Shawn Kendall… Had him as a teacher once. Used to rag on him about Java; now I’m doing it too. LOL.

Actually, Shawn abandoned his scene graph and has gone back to J3D now that its outy of stasis again :slight_smile: