2d with java3d.

I was just wondering if there are many people doing 2d with java3d? I mean the graphics2d libs suk (try to do real time affine transforming) and if you don’t want to use opengl how good is java3d for 2d?

I suppose a scenegraph API is not meant for 2D graphics per definition. If one doesn’t want to use openGL but wants to use j3d for 2d graphics, I’d like to know what his or hers reasons are. To me it doesn’t seem to make a lot of sense.

I’m not a lot of help, am I? ;D

Not that I’ve done it, but have thought about it…

You could use J3D for a 2d overhead isometric type game. There are some benefits over using models as opposed to sprites (e.g. clothes additions with hundered of sprites, natural scaling).

Come to think of it tho, why you wouldn’t then go on and make it full 3d, who knows?

Kev

It seems to me that probably you would be better off using one of the opengl apis rather than java3d for this as I don’t expect you gain much from the scenegraph in this kind of instance.

OpenGL is a good choice for 2d-games if they want to be hardware accelerated in a platform independant way. :slight_smile:
So Jogl is your bet I guess.

If you just want hardware accelerated 2D then you can just use Java2D.

Kev

[quote]If you just want hardware accelerated 2D then you can just use Java2D.
Kev
[/quote]
On Linux? On Macos? I thought SUN is going to implement hardware acceleration for Linux and Macos Java2d somewhen after Java 1.4.2…

Also OpenGL is a low level API, so if you issue a call to draw a bitmap (texture) to an unprojected view you really know it’s fast. :slight_smile:

Of course you’re suddently dependant on a native library, which you could argue isn’t really java any more (TROLL).

Kev

[quote]Of course you’re suddently dependant on a native library, which you could argue isn’t really java any more (TROLL).
Kev
[/quote]
That’s correct. :slight_smile:

This is a main reason why I hope very much that SUN’s going to include Jogl, Joal and Jinput into the standard Java2. So that your Java programs stay platform independent (which is the biggest thing since I saw Taos).

If you give your JAR to anybody and say: well then, you just need to have a recent JRE installed or laying around the network, it’s nearly like a double click on a Exe and hence not a big problem.
However if you’ve to say: go and download Jogl from X, install it, then Joal from Y and install it, then Abc from Z and install it: that sucks. Then you better do it in C++. :slight_smile:

Oh well, now I’m pretts off-topic; sorry.

…or just use java web start: one click, waaaait for it, and there it is - all dependent libraries installed, cached, links on desktop etc. and the program is now up and running ;D

Can’t be easier than that…

Just a question, I really don’t know the answer:

With OpenGL, if you’ve got, say a 16MB onboard graphics support, that isn’t designed for 3D and hence isn’t accelerating OpenGL, wouldn’t Java 2D acceleration still work, since its not trying to use OpenGL?

Or does OpenGL allow you to do something clever for 2D lark?

Or is normal software mode OpenGL fast at 2D?

Or do all graphics card support OpenGL to some level or other (onboard graphics cards)?

I’m kinda looking around at 2D spritey type games support low spec machines (hopefully laptops also). Well I realise some laptops (like mine) are coming with 3D acceleration, I also know most don’t.

Kev

I used openGL for 2D and these were the pros:

  • HW scalable sprites
  • HW transparency (it gives 2d games a cool look!)
  • HW dinamyc lights
  • HW rotations
  • Speed!!! 3d accelerators are able to draw millions of triangles per second when you need (for 2d games) about 1000 per second

And effects like:

  • Fade to black! in hardware is a lot faster (using transparent textures)
  • Zoom or rotate the whole game area

I’m also thinking about using J3D for 2D, because of its perfect timer (I’m bored of J2D timer, and I don’t know when Sun will fix it), its speed (3d demos run very smooth), and its platform independency.

I think that a lot of online gamers have installed both J2D and J3D, and all of them have a 3D video card.
If you use J3D you don’t need to force users to download any propetary DLL, and you don’t need to use OS specific tricks.

I think you can use also immediate mode that is more similar to openGL. It is slower than a good scene graph but if you need only thousands of triangles it shouldn’t be a problem :slight_smile: