[MDX] Weird flickering going on
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
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.
That's right, when creating the D3D device, use
presentParams.PresentationInterval = useVSync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
to (de)activate vsync.
presentParams.PresentationInterval = useVSync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
to (de)activate vsync.
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
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].
These mysterious bugs are the most fun ones [smile].
Are you sure you clearing the depth buffer? If not, it will cause some strange flickering and artifacts.
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
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement