Jump to content
  • Advertisement
Sign in to follow this  
lochnator

Window Flicker on load with directx

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

Currently i am creating a window, with no background brush.  This is because i will be using directx to draw the background with black.  The issue is for a split second when the window is loaded and created, since it has no background brush, it's white.  Once directx kicks in and initializes it then clears the background with a black color that i want.  Does anyone have any advice/tips on how to prevent the quick white to black background flicker on initial load using only directx for background painting on the window.

Share this post


Link to post
Share on other sites
Advertisement

This from the old Quake source code looks like what you need; it comes immediately after your window is created but before Direct3D is initialized: https://github.com/id-Software/Quake/blob/master/WinQuake/gl_vidnt.c#L258

// because we have set the background brush for the window to NULL
// (to avoid flickering when re-sizing the window on the desktop),
// we clear the window to black when created, otherwise it will be
// empty while Quake starts up.
	hdc = GetDC(dibwindow);
	PatBlt(hdc,0,0,WindowRect.right,WindowRect.bottom,BLACKNESS);
	ReleaseDC(dibwindow, hdc);

Share this post


Link to post
Share on other sites

 

This from the old Quake source code looks like what you need; it comes immediately after your window is created but before Direct3D is initialized: https://github.com/id-Software/Quake/blob/master/WinQuake/gl_vidnt.c#L258

// because we have set the background brush for the window to NULL
// (to avoid flickering when re-sizing the window on the desktop),
// we clear the window to black when created, otherwise it will be
// empty while Quake starts up.
	hdc = GetDC(dibwindow);
	PatBlt(hdc,0,0,WindowRect.right,WindowRect.bottom,BLACKNESS);
	ReleaseDC(dibwindow, hdc);

Pretty straight forward, simply paint your background black before d3d initializes

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!