Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (492)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
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  
  Two GLCanvas fighting for resources...  (Read 1798 times)
0 Members and 1 Guest are viewing this topic.
Offline WhiteHexagon

Senior Newbie





« Posted 2006-04-08 16:27:51 »

Now that I've resolved by system stability issues I've been able to test my game a bit better and I've noticed another problem...

I have two GLCanvas on screen at once and it seems that they are fighting for resources!

First both canvas are running around 20fps, then one will jump to 60fps (monitor refresh rate) and the other will be starved of thread running time and only update maybe .3fps.  This isn't consistent and the two will occasionally switch roles. 

Also I've noticed around every 5 minutes there is a reshape being triggered.  But I think this is a seperate issue.

My log file is below, maybe its more clear from that... one panel is called 'main' and the other 'selected'

Cheers

Peter

JOGL nightly build from 2006-04-06
W2K Sp4
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

---------------------------------------------------------------------------------------------------------------------------------------------

[Debug]Selected Rendered 285 frames in 5.0 seconds = 57.0 FPS
[Debug]Selected Rendered 300 frames in 5.0 seconds = 60.0 FPS
[Debug]Selected Rendered 300 frames in 5.0 seconds = 60.0 FPS
[Debug]Selected Rendered 301 frames in 5.0 seconds = 60.2 FPS
[Debug]Selected Rendered 297 frames in 5.0 seconds = 59.4 FPS
[Debug]Selected Rendered 300 frames in 5.0 seconds = 60.0 FPS
[Debug]Main Rendered 4 frames in 34.875 seconds = 0.11469534050179211 FPS
[Debug]Selected Rendered 300 frames in 5.016 seconds = 59.80861244019139 FPS
[Debug]Main Rendered 91 frames in 5.0 seconds = 18.2 FPS
[Debug]Main Rendered 196 frames in 5.0 seconds = 39.2 FPS
[Debug]Main Rendered 198 frames in 5.015 seconds = 39.48155533399801 FPS
[Debug]Main Rendered 225 frames in 5.0 seconds = 45.0 FPS
[Debug][RESHAPE] (0,0) (1118,895)
[Debug][RESHAPE] Done
[Debug]Main Rendered 213 frames in 5.0 seconds = 42.6 FPS
[Debug]Main Rendered 267 frames in 5.0 seconds = 53.4 FPS
[Debug]Main Rendered 284 frames in 5.0 seconds = 56.8 FPS
[Debug]Main Rendered 244 frames in 5.0 seconds = 48.8 FPS
[Debug]Selected Rendered 165 frames in 41.718 seconds = 3.955127283187113 FPS
[Debug]Selected Rendered 300 frames in 5.016 seconds = 59.80861244019139 FPS
[Debug]Selected Rendered 301 frames in 5.0 seconds = 60.2 FPS
[Debug]Selected Rendered 300 frames in 5.0 seconds = 60.0 FPS
[Debug]Selected Rendered 300 frames in 5.0 seconds = 60.0 FPS
[Debug]Selected Rendered 300 frames in 5.0 seconds = 60.0 FPS
[Debug]Selected Rendered 282 frames in 5.0 seconds = 56.4 FPS
[Debug]Main Rendered 69 frames in 36.172 seconds = 1.9075528032732503 FPS
[Debug]Selected Rendered 267 frames in 8.047 seconds = 33.18006710575369 FPS
[Debug]Selected Rendered 300 frames in 5.0 seconds = 60.0 FPS
[Debug][RESHAPE] (0,0) (1118,895)
[Debug][RESHAPE] Done
[Debug]Main Rendered 153 frames in 11.047 seconds = 13.849914003801937 FPS
[Debug]Selected Rendered 299 frames in 5.0 seconds = 59.8 FPS
[Debug]Selected Rendered 300 frames in 5.0 seconds = 60.0 FPS
[Debug]Selected Rendered 301 frames in 5.016 seconds = 60.00797448165869 FPS

whitehexagon.com - Building a new game world, one brick at a time.
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #1 - Posted 2006-04-09 02:10:19 »

Do you have a test case?

How many threads do you have running causing these canvases to repaint themselves? Ideally you should have only one "animation" thread forcing the canvases to redraw. Note that the Animator class in com.sun.opengl.util has the option of animating more than one GLDrawable.
Offline WhiteHexagon

Senior Newbie





« Reply #2 - Posted 2006-04-09 06:21:45 »

Hi Ken,

Ah ha, you are right and that makes sense, I currently have quite seperate graphical components on screen at the same time, but each with it's own Animator. 

So do I need to have a global Animator for all canvases that I pass to every component?  that is going to make the code quite messy I think...  or do you think I'd be better to wrap the Animator into a singleton? btw can it be started without any canvas initially with no problems?  I see an empty constructor.
Also I have a third panel with a GLCanvas and a seperate Animator that I stop() after a single frame.  So if I only have a single Animator for the game then I guess I could just return immediately from display() method when the anim is paused in that case.

Thanks for your help again Smiley

Peter

whitehexagon.com - Building a new game world, one brick at a time.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline WhiteHexagon

Senior Newbie





« Reply #3 - Posted 2006-04-09 08:11:38 »

Seems to work with a single new Animator()  and then passing this instance to the other components and adding the canvases later Smiley

Thanks.

whitehexagon.com - Building a new game world, one brick at a time.
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.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (33 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (40 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
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!