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 (568)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  J3D OpenGL and DirectX SDK differences  (Read 2017 times)
0 Members and 1 Guest are viewing this topic.
Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Posted 2002-11-22 10:22:37 »

What are the main differences for these two, I understand that OpenGl and DirectX are different APIs. Let's say if I develop on DirectX, will it run OpenGL mode?

As far as I understand DirectX mode is more advanced and up to date due Microsofts love for pc games, is this true?


I hear that people have had problems creating full screen exlusive with DirectX SDK. What is this about?

And finally, how is the Canvas3D buffered, or do I have to use bufferstrategy/ double buffering. I read somewhere in the docs that Canvas3D has innate double buffering. Is this true?

Is it possible to mix 3D and sprite graphics? Like make qui with 2D(Health bars, messages, scripting ect.) and then use 3D for the game itself?

The damn free J3D book is down. I guess I have to wait for awhile until I can start studying how the J3D api works.


Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #1 - Posted 2002-11-23 16:52:38 »

I'd like to add one more question that came up while I was studying the sun tutorial, old javagaming forums and the docs/demos.

Is there any way to build a rendering loop as in 2d? I understand that things are handled differently in java3D, but overriding paints and repaints would relieve a lot of resources.

Just to ask, what do you guys use, onscreen or offscreen rendering?

As far as I understand, it can be done through creating offscreen Canvas3D and then rendering it onto buffered image. This however seems to be awfully slow process, at least it was signifigantly slower than onscreen as I tried. There might have been something wrong with my code, as I don't understand Java3D very well yet.

In all the demos the animations were "automatic" and I couldn't find rendering loops anywhere. They use paint and repaint right? How do I forfeit this or am I supposed to do it at all?
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #2 - Posted 2002-11-24 09:14:12 »

Quote

Is there any way to build a rendering loop as in 2d?


There are several ways. My current favorite is to have a Behavior/WakeUpCondition snapped to the scenegraph that drives the game. If you use WakeUpOnElapsedFrames(0), this is a real renderloop in teh classical sense. But driving Java3D in such a tight loop will make it unsmooth. I prefer to have a decent fps value and wakeup the behavior in timeslices.

Another option would be to overload postSwap (unsure wether the name is ok, look it up) to do you action whenever the last frame is on the screen. Again, results in a closed loop.

My first guess was to try a seperate thread driving the game, but this is not synchronized with the rendering that it may happen that you update an object position and the camera in different frames....

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #3 - Posted 2002-11-24 09:53:41 »

Quote
I understand that OpenGl and DirectX are different APIs. Let's say if I develop on DirectX, will it run OpenGL mode?

To the J3d programmer, this should make no difference between the two, in reality theres a couple of points you should remember..
Quote
As far as I understand DirectX mode is more advanced and up to date due Microsofts love for pc games, is this true?

Nope, actually the wrong way around, the DX version is missing a few features here and there, namely:
Can't adjust wireframe width
Poly offset is ignored
A few other details with line/point rendering that i can't remember (mainly antialiasing related).

Also I think both versions may have problems with some of the more obscure texture wrapping modes, but this may have been fixed.

Quote
I read somewhere in the docs that Canvas3D has innate double buffering. Is this true?

If i remember correctly, you chose how many buffers you want on creating the Canvas3D.

For the game loop I tend to favour over-riding preRender() in Canvas3D, which works nicely and keeps you in sync properly with the internal rendering.

For 2d, if you want to use Graphics2D or similar, then that involves the rendered scene being read back over the agp, drawn to, and then copied back across into video memory - hence its dog slow Sad A much better way is to emulate 2d by using textured quads aligned to face the camera - attaching geometry to the view platform works nicely for HUDs.

Last time i tried it, offscreen rendering wasn't hardware accelerated, and so very slow, I think I heard this being fixed in a recent version though, or it might still be planned.. Note, all the above was from my experiences with J3d about 6-12 months ago, and so some of these problems might have been fixed.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #4 - Posted 2002-11-24 12:39:00 »

What I'm basically doing now is modifying keyNavigate app so that it looks like the primitive version of a 3D game.

It seems to be that if I want rendering loop I have to overrider or overload something in Canvas3D, but what Herkules said it seems to me that it is not mandatory to even have timer thread. This is very confusing compared to 2D.

My current plan now is to extend class from Canvas3D and then implement it to Runnable. Then over-ride the preRender and then start to worry about what to display.

How does drawing work on Canvas3D. I assume the Canvas3D still works the drawing alone from the scenegraph? Even if I do override preRender the Java3D continues with its normal rendering loop?

Edit:
Pity me looks like I don't have to play with timers this time or do I since I can access the thread in Canvas3D.

Fun.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

Riven (10 views)
2014-10-02 14:36:20

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

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

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

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

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

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

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

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

UprightPath (53 views)
2014-09-20 20:14:06
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!