Jump to content
  • Advertisement
Sign in to follow this  
D3DXVECTOR3

[MFC] flickering/trials

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

Im haveing troubles with updating the window and flickering. A quick search and I found a solution that mentions overrideing the OnEraseBkgnd(). This worked... almost. I still have some flickering but now it leaves trails, scroll trails. Im using the OnPaint() method because I cant get OnDraw() to work :S BOOL MyView::OnEraseBkgnd(CDC* pDC) { //CScrollView::OnEraseBkgnd(pDC); return TRUE; } How do i avoid flickering / fix this!?

Share this post


Link to post
Share on other sites
Advertisement
You may want to try double-buffering without erasing the background each time. Use this code to redraw the window without erasing the background:

[window object].RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);

Share this post


Link to post
Share on other sites
thx cloud007 i will try it 1st thing in the morning.

@ DevLiquidKnight yes im using BitBlt to copy an image to screen. Is that good or bad?

Share this post


Link to post
Share on other sites
RedrawWindow() almost did it, the image is not flickering anymore but the rest (grid, lines ect that im drawing) are still flickering. Did I forget something!?

Share this post


Link to post
Share on other sites
Maybe the lines,grid and etc was not being draw on the backbuffer's DC.Checking that will help you.If you are using backbuffer,everything you draw must be draw on the backbuffer before copying it to the actual DC.

Share this post


Link to post
Share on other sites
If I am not drawing on the backbuffer then what do I need to do!?
Currently the flickering is gone, but I still have trails. Here are 2 screenshots to show the current state.

http://members.home.nl/skynet2097/Temp/screen1.PNG
http://members.home.nl/skynet2097/Temp/screen2.PNG

I have 2 image variables. original and copy. I copy the original to the copy-image, draw stuff onto the copy-image and than copy it to sceen.



CImage m_MainImage;
CImage m_CopyImage;

// get a pointer to the device component from the specified handle
CDC* l_DC = CDC::FromHandle(m_CopyImage.GetDC());

// Copy original image
m_MainImage.BitBlt((HDC)l_DC, 0, 0, l_iWidth, l_iHeight, 0, 0, SRCCOPY);

DrawGrid(l_DC);

DrawSomeMore(l_DC);

// Copy the image to the current device
dc.BitBlt( 0, 0, l_iWidth, l_iHeight, l_DC, l_iHPos, l_iVPos, SRCCOPY);


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!