http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

TheGrumpyProgrammer



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DirectX Blues



Neil wrote:
> 
> I'm having a few problems with my DirectX program. I was wondering if
> someone could please help me with a few questions:
> 1. How do I check Windows messages to see when the program becomes avtive
> (i.e. not minimized). I've read "just look for the WM_ACTIVATE message, so
> I tried toggling a "BOOL Active" every time I get that message, but it
> doesn't seem to work.

When your app is deactivated you may lose the memory allocated for your
directx program. Therefore if your program detects a WM_ACTIVATE, you
should call functions which restore your draw surfaces and sound
buffers, and reloads the data you want into those surfaces and buffers.

> 2. Can I safely assume that the screen's pitch as stored in the surface
> descreption after locking a surface will remain constant? I.e. Can I get it
> once and save it, or do I have to check it every frame?

Not sure about this one, I didn't deal with the pitch in my game (my
first one, its at http://www.ozemail.com.au/~donaldha/eradicator ).

> 3. How do I align my page-flips with the monitor's refresh? Is this done
> automatically? Can I continue calculating something else while I wait?
> 4. Why does the following code not work? I'm using page-flipping, but the
> screen is still flashing psychedellically and exhibiting massive tearing. I
> can see pixels I've drawn over as semi-transparent just as though I were
> writing directly to the screen even though I'm pretty sure I'm not; I know
> I'm not trying to.

I think all of this will be solved by including the DDSFLIP_WAIT flag in
your call to IDirectDrawSurface::Flip, and DDBLT_WAIT in your call to
IDirectDrawSurface7::Blt. However, the DDBLT_WAIT flag can be rather
inefficient... I believe there is a better alternative given somewhere
in the DirectX.chm help file in the sdk. IDirectDrawSurface7::Flip by
default waits for the vertical retrace. It will only flip other than
during a vertical retrace if you specify DDFLIP_NOVSYNC.

--
Don Halloran
=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html



  • References: