www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/21/17:00:39

Message-ID: <199807212300450430.00099FEB@pogwizd.tcs.uni.wroc.pl>
In-Reply-To: <6onnuh$12p$2@oravannahka.Helsinki.FI>
References: <6onnuh$12p$2 AT oravannahka DOT Helsinki DOT FI>
Date: Tue, 21 Jul 1998 23:00:45 +0200
From: "Pawel Kowalski" <pk AT tcs DOT uni DOT wroc DOT pl>
To: djgpp AT delorie DOT com
Subject: Re: Allegro and blitting to screen
Mime-Version: 1.0


*********** REPLY SEPARATOR ***********

On 98-07-17, at 18:00, Tuomo A Turunen wrote: 

>HELP !!??
>I'm programming a very nice game with DJGPP and allegro. I use SVGA
>640*480*256 colors, so graphic looks good. But the problem is the
>double buffering. It's just too slow. Example :
>
>  BITMAP *buffer = create_bitmap(640, 480);
>
>  clear(buffer);
>  while( game_continues) {
>    // some drawwing on the buffer
>    blit(buffer, screen, 0, 0, 0, 0, 640, 480);
>  }
>
>That is a the only way I can think of, but itsn't fast enough.
>So is there any faster way to do that 'blit(buffer, screen, ...)' ???
>
>Tuomo Turunen

I tried Allegro demo to find out what's faster: page flipping of double buffer.
I was almost sure that the firtst technique is ~1/4 faster. Well, ...:
640x480x8       DB - 106fps, PF - 59fps
800x600x8       DB - 66fps, PF - 60fps
1024x768x8      DB - 39fps, PF - 60fps
Why PF fps is always the same? I tried removing vsync_in() from 
vesa_scroll(int, int) (djgpp/vesa.c) but with no effect...

Double Buffer is better than Page Flipping if:
  -RAM is twice as fast as video memory & rendering a frame requires clearing
   the screen (buffer) each time

time  |--------------------------------------------------------------------->
DB    |clear_the_buffer|-draw_everything-|-----blit_buffer_to_screen-----|
PF    |---------clear_the_screen---------|---draw_everything_on_screen---|

   So, IF draw_everything is faster than clear_the_buffer, THEN I suggest
   you should use double buffer, ELSE (if draw_everything is slower than   
   clear_the_buffer) you should use page flipping.

  -IF rendering a frame doesn't require clearing the screen, you should use
   page flipping, but if draw_everything_on_screen is slower than 
   draw_everything + blit_buffer_to_screen you should use double buffer
   of course.

I think I made myself clear, otherwise let me know...

Pawel Kowalski

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019