Sign in to follow this  
D3DXVECTOR3

[MFC] flickering/trials

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this