Java-Gaming.org
Java4K winners:
[
by our judges
|
by the community
]
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members
News
: Read the
Java Gaming Resources
, or peek at
the official Java tutorials
Home
Help
Search
Login
Register
Java-Gaming.org
>
Java Game APIs & Engines
>
OpenGL Development
>
JOGL Development
>
jogl fps lock
Pages: [
1
]
Print
jogl fps lock
(Read 2103 times)
0 Members and 2 Guests are viewing this topic.
starlord
Jr. Member
Posts: 63
jogl fps lock
«
on:
2003-06-20 00:31:40
»
how can i lock frame rate let's say to 50fps in jogl?
do i need to create own animator class or how?
Ken Russell
JGO Kernel
Posts: 3446
Medals: 3
Java games rock!
Re: jogl fps lock
«
Reply #1 on:
2003-06-23 02:17:10
»
You can measure your frame time at the beginning of your display() method and Thread.sleep() or Object.wait() for the remainder of say 20 ms.
Someone was posting on the gl4java mailing list about this recently and it probably should be added to the Animator class.
However think about why you want to do this -- is it to keep CPU usage down? Or to avoid looking at wall clock time in your animation loop? If it's the latter then you should probably consider adding a notion of elapsed time to your animations, because doing so will provide framerate independence.
vydias
Jr. Member
Posts: 52
Welcome to my world!
Re: jogl fps lock
«
Reply #2 on:
2003-07-05 13:24:28
»
keeping CPU usage down is always a good thing if you want to increase stablity on all systems. I've notice on one of my systems that I will lockup occassionally playing games or doing cpu intensive stuff that run at full cpu usage for prolong periods of times. Its my guess that I lock up because of the extra heat that my cpu/video card is producing.
IMO I'm thinking a frame lock might not be a bad idea since I'm sure it would have much tighter accuracy then me placing a sleep in my code. I know gage has a more accurate timer and a native timer could be used but we are talking about a Java 3d gaming API and ease of use/robustness of its current framework should be one of its aims.
Just a though,
Mark
Games published by our own members! Go get 'em!
oneyoon
JGO n00b
Posts: 3
Java games rock!
Re: jogl fps lock
«
Reply #3 on:
2003-07-05 19:40:31
»
If you look at the code for the Animator class, the main thread runs in a tight loop with no sleep() or yield(). This is not very swing friendly, and I noticed that in some of my practice programs, the gui interaction was very jerky.
Please put in FPS functionality, so swing events can be handled in a timely fashion and so we can drive other functions like AI, etc. within controlled timeslices.
I ended up cut and pasting the Animator class to my own package and adding a sleep(33) within the run loop. Oh by the way, is the GLCanvas.willSetRenderingThread() supposed to be protected? or was the "public" modifier left off by accident? Can it be public so we can use the NVidia bug fix from classes we make from scratch?
If you don't want to mess with the Animator class, I bet you can just put a sleep() line at the end of your display() code. I don't bother with calculating the exact time delta, right now, because my notebook fps tops at 30fps, and I'm on winXP so the timer is not accurate anyways.
After the sleep fix, my programs run just like it did in GL4Java, except for any demo with teapots...Can anyone port the glutTeapot() soon? I really like the teapot!
starlord
Jr. Member
Posts: 63
Re: jogl fps lock
«
Reply #4 on:
2003-07-05 23:41:53
»
currently i run also own animator with sleep,hopefully they integrate GLAnimCanvas like in gl4java, this allow's FPS locking stuff..
Bornter
Guest
Re: jogl fps lock
«
Reply #5 on:
2003-07-06 03:00:49
»
I think that a Fps-lock like we know and love it from Gl4java via myGLcanvas.setAnimateFps(50) is a must-have. (This is no complain, because Jogl is very young, it's just a suggestion. :-)
There are many cases where the animation of the GLcanvas suffices with 50 fps (or any other value).
In the model-view-controller (MVC) system of a few full-price games I know it's usual to limit the FPS of the view-part to a fixed value (changable via option maybe) so that the fixed timer based model-part driving the simulation got it's CPU time in a reliable way.
gregorypierce
JGO Strike Force
Posts: 905
I come upon thee like the blue screen of death....
Re: jogl fps lock
«
Reply #6 on:
2003-07-10 15:10:00
»
Always better to be relatively slow consistently than to speed up and slow down all the time
http://www.gregorypierce.com
She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Pages: [
1
]
Print
Jump to:
Please select a destination:
-----------------------------
Games Center
-----------------------------
=> Featured Games
=> Showcase
=> Contests
===> LWJGL16k - 2011
===> 4K Game Competition - 2012
===> JGO Comp Petite
===> Finished Contests
=====> 4K Game Competition - 2011
=====> 4K Game Competition - 2010
=====> 4K Game Competition - 2009
=====> 4K Game Competition - 2008
=====> 4K Game Competition - 2007
=====> 4K Game Competition - 2006
=====> 4K Game Competition - 2005
=====> Tiny Game 2010
=====> JGO Comp 2009
=====> 16K LWJGL Competition - 2005
=====> Java Technology Game Development Contest - 2004
-----------------------------
Discussions
-----------------------------
=> General Discussions
===> Suggestions
=> Business and Project Discussions
===> Jobs and Resumes
===> Community & Volunteer Projects
=> Miscellaneous Topics
-----------------------------
Game Development
-----------------------------
=> Newbie & Debugging Questions
=> Articles & tutorials
=> Game Play & Game Design
=> Game Mechanics
===> Artificial Intelligence
=> Networking & Multiplayer
=> Performance Tuning
=> Shared Code
-----------------------------
Java Game APIs & Engines
-----------------------------
=> Engines, Libraries and Tools
===> Java 3D
===> JInput
===> jMonkeyEngine
===> Xith3D Forums
===> Tools Discussion
=> Java 2D
===> JavaFX
=> OpenGL Development
===> JOGL Development
===> LWJGL Development
=> Java Sound & OpenAL
===> JOAL Development
=> Java on Mobile Devices
===> Android
===> J2ME
Loading...