From: Sven S. <svs...@st...> - 2001-11-12 14:19:56
|
Jindrich Sarson wrote: > thanx to all with help with page flipping. But when I implemented it, > my graphics began flipping very much. I'm not sure exactly what you mean with flipping here: if you implement page flipping, it surely would be a pity if it didn't flip? :-) > <begin code>---- [snip] > textout(bmp,font,"After show_video_bitmap() ",30,30,2000); > show_video_bitmap(bmp); Probably you meant to do these lines in reverse order? With this in mind, your program behaves as expected on my computer. > I sow, that first video bitmap overlap screen bitmap, so it is written > directly to screen, istead of any other place in video ram. `screen' covers all of video memory, so there is no "other place". This is not a bug, it's a feature -- see the docs on `create_video_bitmap()'. Sven >From <all...@ca...> Mon Nov 12 06:37:05 2001 Received: from raven.upol.cz [158.194.120.4] by canvaslink.com with ESMTP (SMTPD32-6.00) id A45F9EDF025E; Mon, 12 Nov 2001 06:37:03 -0500 Received: from aix.upol.cz (root@localhost) by raven.upol.cz (AIX4.3/8.9.3/8.9.3) with ESMTP id MAA43196 for <al...@ca...>; Mon, 12 Nov 2001 12:37:05 +0100 Received: from [158.194.208.29] (root@localhost) by aix.upol.cz (AIX4.2/UCB 8.7/8.7) with ESMTP id MAA18318 for <al...@ca...>; Mon, 12 Nov 2001 12:32:55 +0100 (NFT) From: Jindrich Sarson <js...@sa...> To: allegro <al...@ca...> In-Reply-To: <3BE...@st...> References: <3BEEF822.5844.C5C92D@localhost> <100...@vi...> <3BE...@st...> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Evolution/0.14 (Preview Release) Date: 12 Nov 2001 12:34:03 +0100 Message-Id: <100...@vi...> Mime-Version: 1.0 Subject: Re: [AL] Video Bitmaps - is it bug? Precedence: bulk Sender: all...@ca... Reply-To: al...@ca... X-UIDL: 308772634 Status: O Content-Length: 1934 Lines: 65 On Po, 2001-11-12 at 12:15, Sven Sandberg wrote: > > I'm not sure exactly what you mean with flipping here: if you implement > page flipping, it surely would be a pity if it didn't flip? :-) Yes, I thought flickering... So my small pgm again, with comments, what I thought, that it will do: #include <allegro.h> void main() { allegro_init (); install_keyboard (); install_mouse (); install_timer (); set_color_depth (16); set_gfx_mode (GFX_AUTODETECT, 640, 480, 640*2, 480*2); BITMAP *page1 = create_video_bitmap(640,480); BITMAP *page2 = create_video_bitmap(640,480); // I thought, that if I create video bitmap, it is created in video // memory, but not in part of memory, that is currently visible. // So I tried to use two pages, that I want to switch to screen // after redraw. When I used double buffering - with writing to // memory bitmap and then to screen, it works, but it is slow.... BITMAP *bmp = page1; int key; int page = 1; do { acquire_bitmap(bmp); clear_to_color(bmp,page*500); // So here I'm writing to first video bitmap, I thought, that it is // invisible, but is it not true. Everything is written to screen.. textout(bmp,font,"Before show_video_bitmap()",30,30,2000); release_bitmap(bmp); key = readkey(); // As you can see here - I excepted, that here will not be // any graphics on screen acquire_bitmap(bmp); // And here I excepted, that my video bitmap is showed... show_video_bitmap(bmp); textout(bmp,font,"After show_video_bitmap() ",30,30,2000); release_bitmap(bmp); if (page == 1) { bmp = page2; page = 2; } else { bmp = page1; page = 1; } key = readkey(); } while ((key & 0xff) != 'q'); remove_keyboard (); remove_mouse (); remove_timer (); allegro_exit (); } END_OF_MAIN() So it doesn't work - what I'm doing wrong? Thanx, Jindra |