Jump to content
  • Advertisement
Sign in to follow this  
u235

[MDX] Weird flickering going on

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

My terrain rendering application was working perfectly ('pefectly' being a relative term based on phase of development). One day, though, with no changes to the code, the program still works like it was except there is this horrendous flickering and I can't for the life of me figure out what is causing it. The strange part is, I ran my app in PIX and whenever I use F12 to take a screnshot, the screenshot comes out exactly like it should, yet I still get the horrendous flickering. Also, PIX reported an almost constant 60 FPS, so it may have something to do with vsync, but I doubt it. However, if you think it may have something to do with it, I don't know how to turn off vsync so an answer for that would be much appreciated. Thanks for the help. -AJ

Share this post


Link to post
Share on other sites
Advertisement
You can control V-Sync with the PresentParameters.PresentationInterval property. But it is still possible that your GFX driver overrides these settings. It is somewhere in the control panel for your GFX but depends on the model and driver you use.

Share this post


Link to post
Share on other sites
That's right, when creating the D3D device, use

presentParams.PresentationInterval = useVSync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;

to (de)activate vsync.

Share this post


Link to post
Share on other sites
Quote:
Original post by Enselic
How do you render?

I would also recomend that you post as much source as possible.


I apologize, but I didn't think it mattered since it was working and now it doesn't with no changes to the code. I'm not at the computer that has the code on it right now, though, so I will update this post with code as soon as I get home.

As general overview for how I render:

BeginScene();
Process keyboard input for camera movement
Set new view matrix based on keyboard input
SetStreamSource(0, vb, 0);
device.IndexBuffer = ib;
DrawIndexedPrimitives();
EndScene();

I'll post the actual code as well pertinent code ASAP.

-AJ

Share this post


Link to post
Share on other sites
Well the rendering looks totally ok, though maybe you should read keyboard input prior to BeginScene().

These mysterious bugs are the most fun ones [smile].

Share this post


Link to post
Share on other sites
Quote:
Original post by Enselic
These mysterious bugs are the most fun ones [smile].


Indeed [smile]


Quote:
Original post by Sr_Guapo
Are you sure you clearing the depth buffer? If not, it will cause some strange flickering and artifacts.


I'm very sure. That was actually the first thing I checked. The first line of the OnPaint override is:

device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, whatever, other, paramters, this, function, takes);

-AJ

Share this post


Link to post
Share on other sites
Do you render inside the OnPaint method? In this case you have to make sure that you have disabled the background drawing of the control you use. If you don’t do this it can cause flickering between your image and the background that is used to clear the control.

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!