From: Peter W. <tj...@al...> - 2002-07-11 04:24:57
|
On 2002-07-09, Vincent <Vin...@ar...> wrote: > However, I am uncomfortable saving these in an auto buffer. > If we do: > > AL_GFX_STATE state; > al_save_state(flags, &state); > al_restore_state(&state); > > Then the stack is going to take quite a lot of data. It would > require the following, which would then keep track of the flags > and only allocate what's necessary for what was requested: > > AL_GFX_STATE *state; > state=al_save_state(flags); > al_restore_state(state); /* deletes state ? */ - Allocing is a bit slower than not; - Allocing can fail, so strictly speaking you need to check the return value; - You need to separate the restore and delete functions, otherwise you cannot save the state and not restore it later. So a dynamic-allocation interface looks like it will require four functions (create, destroy, save, restore) and error checking. I don't really want that. PS. I thought of something useful that could be done with AL_GFX_STATEs. For a window system, you could restore the previous state before calling a window's update hook, then save the state afterwards. That way the update hook can depend on the graphics state being unchanged from the last time it was called. -- 王浩禎 >From <all...@ca...> Thu Jul 11 03:10:52 2002 Received: from hotmail.com [64.4.19.21] by canvaslink.com with ESMTP (SMTPD32-6.00) id AF7A1AED010C; Thu, 11 Jul 2002 03:10:50 -0400 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 11 Jul 2002 00:10:16 -0700 Received: from 194.215.209.75 by lw12fd.law12.hotmail.msn.com with HTTP; Thu, 11 Jul 2002 07:10:16 GMT X-Originating-IP: [194.215.209.75] From: "Jussi Nieminen" <ju...@ho...> To: al...@ca... Date: Thu, 11 Jul 2002 10:10:16 +0300 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: <F21...@ho...> X-OriginalArrivalTime: 11 Jul 2002 07:10:16.0625 (UTC) FILETIME=[02331A10:01C228AA] Subject: Re: [AL] QueryPerformanceCounter or similar with Allegro? Precedence: bulk Sender: all...@ca... Reply-To: al...@ca... X-UIDL: 326876272 Status: O Content-Length: 1009 Lines: 30 >From: Jason Winnebeck <gi...@ma...> >Subject: Re: [AL] QueryPerformanceCounter or similar with Allegro? >Date: Wed, 10 Jul 2002 08:30:09 -0400 > >Use that code in Windows, and use an #ifdef to use gettimeofday in UNIX. > >Jussi Nieminen wrote: >> >>Is it possible to asquire a high frequency timer that tels the time since >>the program has started? >>How to do this in Allegro? Crossplatform is not mandatory but it would be >>nice. Hey! How can I use the Windows functions in allegro? If I put the #include <windows.h> directive to the code I get conflicts from the BITMAP structure as: "conflicting types for `typedef struct tagBITMAP BITMAP". If I don't put the #include <windows.h> in the code I get error that tells "implicit declaration of function `int QueryPerformanceFrequency(...)". How to solve this? _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx |