Jump to content
  • Advertisement
Sign in to follow this  
tadobie

flickering

This topic is 5119 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

I'm having a problem with using the CDisplay and CSurface classes. The images I have created flicker so I think that I'm not flipping correctly BUT isn't that all handled by the CDisplay class using: Present() ? Anyway, I'm loading bitmaps like this: TotalScreen->CreateSurfaceFromBitmap(&tmpFrame,PathName,width,height); and TotalScreen->Clear(0); TotalScreen->Blt(xPos,yPos,Surface_1, 0); TotalScreen->Blt(xPos,yPos,Surface_2, 0); ... TotalScreen->Blt(xPos,yPos,Surface_n, 0); TotalScreen->Present(); Then I read something that said you can't flip unless your in full screen mode (is this true?)so I changed : if(FAILED(TotalScreen->CreateWindowedDisplay(hWnd,640,480))) ... to if(FAILED(TotalScreen->CreateFullScreenDisplay(hWnd,640,680,16))) which Failed, returning my message "Failed to Initialize DirectDraw" Am I missing something and/or have I got the right idea? [Edited by - tadobie on September 14, 2004 8:26:55 AM]

Share this post


Link to post
Share on other sites
Advertisement
Um, what classes are these and I want to see them. I can not give you accurate help with out some more information about these classes you are using. But I will try.

Usually, a flicker occurs when you are drawing animation that is not double buffered, hence, can be flipped. Usually full screen applications use two surfaces to solve this problem. One surface is the primary surface and the other is the back buffer. You draw to the back buffer then copy the contents to from the back buffer to the primary surface. This eliminates flickering. Even if you are in windowed mode you can still do this. You just have to make an off screen plain that is used for the back buffer. Where as, in full screen, you would make a special surface that is attached to the primary surface.

In answer to your question, yes, you can’t flip in a windowed mode. Only is full screen mode.

Share this post


Link to post
Share on other sites
Havent used these classes but with DD it is rather tricky to adhear to VSync in windowed mode (ie CDisplay probably doesn't do it).

Not sure why your init fullscreen is failing though. In any case lack of vsync is mainly a problem of tearing if your using double-buffering.

All that said its hard to diagnose since your using classes that most of us don't know that well.

Post a zip with the code and I'll check it out though.

Share this post


Link to post
Share on other sites
A few people have indicated that they didn't know about these classes they are available in the above header found in C:\DXSDK\Samples\C++\Common\Include if anyone was wondering

Share this post


Link to post
Share on other sites
I know where they are... I was just suggesting you upload your code since it's prolly not very long so we could test it out and try to help ya.

Share this post


Link to post
Share on other sites
thanks for helping out,
I sussed it out!
I was showing only some of the loaded bitmaps before clearing them instead of waiting til the whole lot were one main surface and just showing that.
Thanks again for your help
I just wanted to say:
The code is in a skeleton with about 6 classes so I found it difficult to find a coherent bit of code to post.
and
I didnt mean to insult your intelligence by giving you directions to the site it's just that many people seem to not know what I'm refering to.

Share this post


Link to post
Share on other sites
Heh, no insult taken. Just wanted to point out that those 6 lines of code weren't incredibly helpfull in diagnosing your problem lol.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!