Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (606)
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  
  Background Color support added  (Read 2148 times)
0 Members and 1 Guest are viewing this topic.
Offline Yuri Vl. Gushchin

Senior Devvie




Speak Java!


« Posted 2003-12-07 10:26:27 »

Background Color support just committed to CVS HEAD.

Background color now rendering with no extra performance cost by  changing canvas clear color before clearing frame buffer.

Additional atom (BackgroundColorAtom) added, additional rendering setup  pass introduced (no performance impact if no background color set, no background existing or packground color set to null).

Appropriate examples added as Xith3DBackgroundColorTest.java and Xith3DBackgroundColorTest.bat.

Yuri

Yuri Vl. Gushchin
JProof Group
Offline Java Cool Dude

Senior Devvie




Java forever


« Reply #1 - Posted 2003-12-07 13:42:18 »

Two thumbs up Smiley
Offline Java Cool Dude

Senior Devvie




Java forever


« Reply #2 - Posted 2003-12-07 15:18:14 »

Hey man just checked the xith3d.jar file in the cvs and it dates all the way back to 10/11/03.
The size is also 484k whereas the nightly build commited by William weighs no less than 650k
Huh
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline abies

Senior Devvie





« Reply #3 - Posted 2003-12-07 15:24:39 »

I would suggest deleting xith3d.jar from cvs. Support libraries - ok, but main library should be not included inside CVS IMHO.

Artur Biesiadowski
Offline Jens

Senior Devvie




Java for games!


« Reply #4 - Posted 2003-12-07 15:25:04 »

You have to run the ant build script to update xith3d.jar.

Xith3D Getting Started Guide (PDF,HTML,Source)
Offline Java Cool Dude

Senior Devvie




Java forever


« Reply #5 - Posted 2003-12-07 15:36:02 »

NVM built it all up using netbeans build all command Smiley
Works like a charm now.
Offline Java Cool Dude

Senior Devvie




Java forever


« Reply #6 - Posted 2003-12-07 16:05:52 »

Me again, I managed to compile the source using the provided ant build, but when I try to run some of my demos, it takes about 2-3 seconds before a null pointer exception surfaces:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
java.lang.NullPointerException
        at com.xith3d.render.RenderBin.addAtom(RenderBin.java:87)
        at com.xith3d.render.Renderer.addRenderSetupAtom(Renderer.java:167)
        at com.xith3d.scenegraph.View.renderNode(View.java:902)
        at com.xith3d.scenegraph.View.renderNode(View.java:1015)
        at com.xith3d.scenegraph.View.getRenderFrame(View.java:824)
        at com.xith3d.scenegraph.View.renderOnce(View.java:717)
        at com.xith3d.scenegraph.View.renderOnce(View.java:655)
        at Xith3DParticles.ParticlesTest.run(ParticlesTest.java:353)
        at java.lang.Thread.run(Thread.java:534)

Also enabling background color gives the performance a firm kick in the nuts (we're talking about 20-30% performance loss on a 2.1 Ghz Athlon, Radeon 9500 Pro machine).
Oh well Cry
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #7 - Posted 2003-12-07 20:15:40 »

Quote
I would suggest deleting xith3d.jar from cvs. Support libraries - ok, but main library should be not included inside CVS IMHO.


100% agree with you there Smiley

Since we're on the topic I think that the reference/xith_utilities.zip isn't needed anymore since it's now in the main trunk.  Same goes for third-party/xith_utilities.jar.

Would anyone object to the removal of those three files from CVS?

Will.

Offline Java Cool Dude

Senior Devvie




Java forever


« Reply #8 - Posted 2003-12-07 23:27:33 »

Fixed my null exception by modifying the RenderBin.
1  
2  
3  
4  
5  
6  
7  
8  
9  
    public void addAtom( RenderAtom atom ) {
        if (curSize == buckets.length) {
            RenderBucket[] newBuckets = new RenderBucket[buckets.length + EXT_SIZE];
            System.arraycopy(buckets, 0, newBuckets, 0, buckets.length);
            buckets = newBuckets;
        }
        if(curSize<buckets.length-1)
          buckets[curSize++].setAtom(atom);
    }

Still, now running my particles system containing 50 billboarded, alpha blend squares, shows a huge performance drop:
Without BackGround color FPS ~1900FPS
With      BackGround color FPS ~1000FPS!!!
:sad panda:
Offline DavidYazel

Junior Devvie




Java games rock!


« Reply #9 - Posted 2003-12-08 01:58:31 »

Thats weird JCD, the first part of that code should obviate the need for the second part.  How could curSize ever be >= to the array size if the preceeding clause increases it in just that condition?

David Yazel
Xith3D Project Founder
http://xith3d.dev.java.net

It may look complicated, but in the end it is just a bunch of triangles
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Java Cool Dude

Senior Devvie




Java forever


« Reply #10 - Posted 2003-12-08 02:30:59 »

Quote
Thats weird JCD, the first part of that code should obviate the need for the second part.  How could curSize ever be >= to the array size if the preceeding clause increases it in just that condition?


No clue and yet it's the only fix that I could put together... Huh
Offline Java Cool Dude

Senior Devvie




Java forever


« Reply #11 - Posted 2003-12-08 04:22:16 »

An example showing performance cut in half after adding a background color.
1  
2  
3  
4  
5  
6  
  public BranchGroup scene(){
    BranchGroup scene      = new BranchGroup();
    Background  backGround = new Background(new Color3f(0,1,0));
    scene.addChild(backGround);
    return  scene;
  }

Trying commenting out the "addChild" part and get blown away by the frame rate increase...
Offline Yuri Vl. Gushchin

Senior Devvie




Speak Java!


« Reply #12 - Posted 2003-12-08 04:53:20 »

Hi,

Sorry, it was a bug in Renderer.java - I forget to clear Render Setup pass bin between passes. This caused overflow of render bin after some time (3000 frames) and slowdown increasing over time.

Just committed a fix. Try now.

Fix provided by JCD replaced by one line in Renderer.java, so just use latest CVS HEAD version.

I tried JCD's test with and without Background node and got exactly the same performance [after applying fix].

Yuri

Yuri Vl. Gushchin
JProof Group
Offline Java Cool Dude

Senior Devvie




Java forever


« Reply #13 - Posted 2003-12-08 05:20:12 »

Yup yup yup Smiley
Offline Ramses

Senior Newbie




Java games rock!


« Reply #14 - Posted 2003-12-18 21:13:57 »

I'm trying to set the background to an image using the code below, but I'm getting the standard greyish background color instead. Am I doing something wrong?

1  
2  
3  
4  
5  
6  
7  
8  
             try
             {
                   BufferedImage im = ImageUtility.readImage("gfx\\bg.png");
                  ImageComponent2D ic2D = new ImageComponent2D(ImageComponent.FORMAT_RGBA, 800, 600, im);
                  Background  backGround = new Background(ic2D);
                  scene.addChild(backGround);
             }
            catch (Exception e) { e.printStackTrace();}
Offline Yuri Vl. Gushchin

Senior Devvie




Speak Java!


« Reply #15 - Posted 2003-12-19 05:05:14 »

Images are not supported as backgrounds for a moment. What you can do is to use textured rectangle/grid of rectangles instead of BG. I am trying to find good accelerated way to draw BG image [I mean the way other than textured rect].

Yuri

Yuri Vl. Gushchin
JProof Group
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.

Elsealabs (16 views)
2014-12-28 10:39:27

CopyableCougar4 (20 views)
2014-12-28 02:10:29

BurntPizza (25 views)
2014-12-27 22:38:51

Mr.CodeIt (15 views)
2014-12-27 04:03:04

TheDudeFromCI (20 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

rwatson462 (58 views)
2014-12-15 09:26:44

Mr.CodeIt (47 views)
2014-12-14 19:50:38

BurntPizza (96 views)
2014-12-09 22:41:13

BurntPizza (116 views)
2014-12-08 04:46:31
How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!