Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: JOGL main loop, simulation and rendering on: 2009-05-07 14:16:38
Ok, ive already seen those examples, but where do you really make the call to the simulation function (collision detection, etc) where is the right spot to place it in the code? i believe it's not in the rendering function which is called everytime by the animator.
i've pointed out a possible solution with a thread, but there may be others like for example with a timertask perhaps?
i mean where do you guys put all the code related to the game in the example above of the wikipedia? in the example above, the
1  
rotateT+= 0.2f
in the display function shouldnt be there because as i see it, it belongs to the simulation function, that's what im specifically asking. We cant place all the gameupdate/logic/etc into the display function just because it's called everytime by the animator. It must be separated.
And finally,
how can you control the timing/FPS of your app then?

2  Game Development / Newbie & Debugging Questions / Re: JOGL main loop, simulation and rendering on: 2009-05-07 10:06:31
i'm sorry but i still see this very much confusing. I ll try to explain myself better

in waht concerns the use of  jogl, i''ll stick to it instead of the other one, for now.

let me ask the question again more precisely

in J2me for example we have:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
new Thread().start()
.....
void run (){
...
...
//main loop
while (!gameover){

//simulation stuff
calculate()

//rendering stuff
repaint()

elapsed=startTime;
startTime=System.currentTimeMillis();
elapsed=startTime-elapsed;
If(elapsed < MILLISECS_PER_FRAME)
{
   thread.sleep(MILLISECS_PER_FRAME-elapsed);
}
Else
{
   thread.yield();
}
}
}


how do you translate the same loop and its componenes to jogl?
3  Game Development / Newbie & Debugging Questions / JOGL main loop, simulation and rendering on: 2009-05-06 16:10:01
hello everybody, im new to jogl and i intend to port a C opengl app to jogl.

here comes my first question:

ive seen jogl examples in the opengl-pack quite simple and they all seem to apply the simulation function y the rendering func as this is called everytime by the Animator.

What i want is to know the right way to implement de main loop and call the simulation func at a given rate as i do in C.

In another java app i did, i used a thread to implement this and the sim and rendering func were called inside the while loop in the thread.

¿how do you guys do this? ¿could you post something like a template? ¿were would you call the whole simulation func in your game and how can you control the FPS?

thanks in advance
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

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

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

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

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (46 views)
2014-11-29 21:32:03

toopeicgaming1999 (113 views)
2014-11-26 15:22:04

toopeicgaming1999 (100 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
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

List of Learning Resources
by SilverTiger
2014-07-31 16:29: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!