This project is read-only.

Flickering in demo app

Aug 3, 2009 at 5:34 PM

I just thought I'd let you know the demo app has a flicker bug on my computer. It seems as if the entire graphics buffer is cleared to a color in-between each render, but without double-buffering.

I'm using ATI Radeon HD4800 series graphics card on Windows 7 RC. I'll let you know if I get around to playing with your code and figure out why this happens.

 

Best,

Anj

Aug 3, 2009 at 6:25 PM

It seems the problem may happen in the EndDraw() method of GraphicsDeviceControl.

If I comment out the Draw() code, the flickering still happens even if nothing is being drawn. I suspect this may be an issue with Windows 7 and the way you use Winforms to render graphics to a component maybe?

Aug 3, 2009 at 8:04 PM
Edited Aug 3, 2009 at 8:05 PM

I also have windows 7 but no flickering occurs. It could be the combination of windows 7 and an ATI card, though, since I have an nvidia card.

Can you tell me if the WinForms sample from the XNA site also flickers on your computer? I borrowed a good deal of the code from there.

In any case, thanks for letting me know about it.

Aug 9, 2009 at 1:16 PM
Not sure which sample you mean? If you give me a link I can try it out
for you.
Aug 9, 2009 at 3:07 PM

The sample is here: http://creators.xna.com/en-US/sample/winforms_series1

Aug 9, 2009 at 3:19 PM
I just tried it, and both samples for 2.0 and 3.0 run just fine here..
Aug 9, 2009 at 8:50 PM

Thanks for trying it. I'm actually sad that it worked - means I'll have to find some time to fix it :(

Aug 9, 2009 at 8:56 PM
Hehe.. sorry to be the messenger. It's probably just a minor flaw, just
compare your code with the sample and maybe you'll spot it. But I
understand it's hard when you don't experience the bug yourself.. If I
get the time I might help you out.

Excellent library though! I'm just getting started using it in my world
right now, and it looks really good! Kudos!
Aug 9, 2009 at 9:38 PM
I found a "bug" in the trunk.fx technique code. I could not render
multiple trees without losing the trunk, and it seems the render states
for the trunk are not set in its technique as it's done in leaves.fx.

I guess it comes down to taste, but in this case I find it natural to
let the shaders handle themselves when it comes to setting the
renderstates so the client code becomes as clean as possible. Especially
since the two shaders used to render a single tree use conflicting
render states.

Anyway, here's what I use in the trunk.fx technique:

technique Technique1
{
pass Pass1
{
VertexShader = compile vs_1_1 VertexShaderFunction();
PixelShader = compile ps_1_1 PixelShaderFunction();

AlphaBlendEnable = false;
AlphaTestEnable = false;
ZEnable = true;
ZWriteEnable = true;

CullMode = CCW;
}
}
Aug 9, 2009 at 11:05 PM

As for the render states, my policy currently says that they are the user's problem. You need to restore your render states after rendering the leaves.