flickering

Started by
7 comments, last by Illumini 19 years, 7 months ago
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]
Don't mug ya self!
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.
Take back the internet with the most awsome browser around, FireFox
these are the classes provided in ddutil.h in the directx 9.0 sdk
Don't mug ya self!
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.
these are the classes provided in ddutil.h in the directx 9.0 sdk
Don't mug ya self!
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
Don't mug ya self!
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.
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.

Don't mug ya self!
Heh, no insult taken. Just wanted to point out that those 6 lines of code weren't incredibly helpfull in diagnosing your problem lol.

This topic is closed to new replies.

Advertisement