i have created in a .cs file a nameSpace called viewer3D and in its class viewer i have created all the necessary funtions to display meshes with SlimDX.
Now i am using this namespace from a form, and i want to use a panel control from this form to display the 3d view, so i need to change the OnPaint method of the panel for the OnPaint function that i have created in the class viewer
how can i make this?Here is the Onpaint functions of my viewer class:
public void OnPaint(Control objeto) { myDevice.SetRenderState(RenderState.CullMode, true); myDevice.SetRenderState(RenderState.FillMode, FillMode.Solid); myDevice.SetRenderState(RenderState.Lighting, false); myDevice.Clear(ClearFlags.Target | ClearFlags.ZBuffer, new Color4(Color.Gray), 1, 0); myDevice.MultiplyTransform(TransformState.Projection,Matrix.PerspectiveFovLH(3.1415F/4,objeto.Width/objeto.Height,1.0F,500000F)); myDevice.MultiplyTransform(TransformState.View,Matrix.LookAtLH(new Vector3(0,170,70),new Vector3(0,170,0),new Vector3(0,1,0))); myDevice.BeginScene(); myDevice.VertexFormat = VertexFormat.Position | VertexFormat.Texture1; for (int i = 0; i < slimdxMeshList.Count; i++) { slimdxMeshList.DrawSubset(0); } myDevice.EndScene(); myDevice.Present(); objeto.Invalidate(); }