Re: flickering skybox (newb question)
- From: "Zman" <zman@xxxxxxxxxxxxxx>
- Date: Mon, 7 Nov 2005 11:13:34 -0800
You are probably competing with windows forms repainting the control.
Off the top of my head you need to set the control style to include
AllPaintingInWMPaint
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolstylesclasstopic.asp
--
Zman (mailto:zman@xxxxxxxxxxxxxx)
http://www.thezbuffer.com
News and Resources for Managed DirectX
"Aaron Lovi" <AaronLovi@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C7042B9E-7D93-4CE3-8DC3-105E76019349@xxxxxxxxxxxxxxxx
> Hi, I'm using C# from Visual Studio 2003 and DX9 for this. Basically, I
> just
> created a skybox into a panel control on a windowed form, and I'm rotating
> it. The rotation is done by a timer that goes off every 50ms, and
> increases
> the "dblAngle". The problem is that there is a lot of flicker. (I hope
> I'm
> posting enough info. If not, please tell me what else to post!)
>
> ------------------------------------------
> Here is how I'm setting my presentParams:
>
> presentParams.Windowed=true;
> presentParams.SwapEffect = SwapEffect.Discard;
> presentParams.BackBufferFormat = Format.X8R8G8B8;
> presentParams.BackBufferHeight = this.Height;
> presentParams.BackBufferWidth = this.Width;
> presentParams.BackBufferCount = 3;
> presentParams.PresentationInterval = PresentInterval.Default;
> presentParams.EnableAutoDepthStencil = true;
> presentParams.AutoDepthStencilFormat = DepthFormat.D16;
> device = new Device(0, DeviceType.Hardware,
> this.panelMain, CreateFlags.HardwareVertexProcessing, presentParams);
> ------------------------------------
>
> Here is how I'm setting up my matrices:
>
> device.Transform.World = Matrix.Identity;
> // dblAngle is incremented by a timer going off every 50ms
> device.MultiplyTransform(TransformType.World, Matrix.RotationY(dblAngle));
>
> device.Transform.View = Matrix.LookAtLH( new Vector3( 0.0f, 0.0f, 0.0f ),
> new Vector3( 0.0f, 0.0f, 400.0f ), new Vector3( 0.0f, 1.0f, 0.0f ) );
>
> device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI/4.0f,
> (float)this.Width/(float)this.Height, 1.0f, 500.0f );
> ----------------------------------------------------------
>
> Here is my render:
> private void Render()
> {
> if (device == null) return;
>
> try
> {
> //Clear the backbuffer to a Green color
> device.Clear(ClearFlags.Target | ClearFlags.ZBuffer,
> System.Drawing.Color.Green, 1.0f, 0);
>
> //Begin the scene
> device.BeginScene();
> // Setup the world, view, and projection matrices
> SetupMatrices();
>
> device.VertexFormat = CustomVertex.PositionColored.Format;
>
> device.SetTexture(0, null);
> device.SetStreamSource(0, vbTerrain, 0);
> device.DrawPrimitives(PrimitiveType.TriangleList, 0, 2);
>
> // draw the skybox
> this.dxSkyBox.Render(device);
>
> //End the scene
> device.EndScene();
>
> device.Present();
> }
> catch (DeviceLostException)
> // etc.
>
>
> --
> Aaron Lovi,
> Poker Villain support
> support [at] pokervillain.com
.
- References:
- flickering skybox (newb question)
- From: Aaron Lovi
- flickering skybox (newb question)
- Prev by Date: Re: Custom EffectStateManagers causes huge amount of memory allocations!
- Next by Date: Re: Custom EffectStateManagers causes huge amount of memory allocations!
- Previous by thread: Re: flickering skybox (newb question)
- Next by thread: RE: flickering skybox (newb question)
- Index(es):
Relevant Pages
|