• Advertisement
Sign in to follow this  

DirectDraw Surfaces

This topic is 4350 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it ok to release surfaces after the main DirectDraw object has been destroyed I ask this because I have classes that use destructors (bitmap classes that managed surfaces), so for example, a global object will call its destructor when the application terminates (After I have destroyed my DirectDraw object which is not part of a class).

Share this post


Link to post
Share on other sites
Advertisement
It's ok to do, yes. When a surface is created, it'll increase the reference count of the DirectDraw (parent) object.

Microsoft recommends releasing things in the reverse order of destruction (I.e. your surface before the DirectDraw object), because it's a cleaner way of doing things (Think of it all like a stack), and I suppose it'll be easier on the memory manager.

But yeah, it's fine.

Share this post


Link to post
Share on other sites
a good idea whe you're starting a project is to impmement a quick reference count check at the end of the program (release the DX device). DX will tell you if you forgot to clean up any DX resources.

if ( m_pd3dDevice->Release() > 0L )
return DisplayErrorMsg ( D3DAPPERR_NONZEROREFCOUNT, MSGERR_APPMUSTEXIT );

Share this post


Link to post
Share on other sites
Also note that installing the debug runtimes will do the abolve automatically for you, and give you a lot more information in the debug output window.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement