From: Artiste on t. W. <a1...@So...> - 2000-07-21 16:18:59
|
Stuart Fischer wrote: > > I have discover that the multi-threading can slow down the rendering ! > > Java may wait before really doing the rendering in the rendering thread, > > and may coalesce rendering. Each frame in my game, i call a rendering, > > but java coalesce them and i have only 1 real rendering for about 30-60 > > frames... > Maybe I don't understand your problem, but I don't know if it is related to > multithreading. > > Are you calling repaint() once per frame in your game loop and calling > sDisplay() in your paint() (or update()) method? > > If so, Java WILL coalesce rendering. > > If this describes your situation, call sDisplay() instead of repaint() in > your game loop. It is OK ! Thanks ! My FPS was about 7 and now it has risen to more than 100 !!! > Simple example: > > public class Game extends GLCanvas implements Runnable { > boolean gameOver = false; > > public void run() { > while(!gameOver) { > updateGameStateForFrame(); > sDisplay(); // DON'T call repaint()! > } > } > > public void paint(Graphics g) { > sDisplay(); > } (I can't do this because paint is final in GLCanvas) > // REST OF Game Class (display()...) goes here > } > > Stuart A11W |