From: Stuart F. <st...@de...> - 2000-07-21 01:49:35
|
> 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. 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(); } // REST OF Game Class (display()...) goes here } Stuart |