예제 #1
0
파일: myFrame.cs 프로젝트: braindef/c-sharp
        protected virtual void Render()
        {
            if (device != null)
            {
                device.Clear(Microsoft.DirectX.Direct3D.ClearFlags.Target, System.Drawing.Color.Blue, 1.0f, 0);
                device.BeginScene();

                //sprite.Begin(SpriteFlags.None);
                //sprite.Draw(texture, Vector3.Empty, new Vector3(10, 10, 0), 0x00ffffff);
                //sprite.End();
                //Microsoft.DirectX.Vector3.
                //Microsoft.DirectX.Matrix

                device.SetStreamSource(0, vb, 0);
                device.VertexFormat = Microsoft.DirectX.Direct3D.CustomVertex.TransformedColored.Format;
                device.DrawPrimitives(Microsoft.DirectX.Direct3D.PrimitiveType.TriangleList, 0, 2);

                //TODO : Scene rendering



                device.EndScene();
                device.Present();
            }
        }
예제 #2
0
        /// <summary>
        /// Called by public render function.
        /// </summary>
        private void _render()
        {
            this._checkThread(3425569000, "CadKit.Direct3D.Canvas._render");

            try
            {
                // Do nothing if the device is null.
                if (null == _device)
                {
                    return;
                }

                // Clear the background.
                _device.Clear(Microsoft.DirectX.Direct3D.ClearFlags.Target, base.BackColor, 1.0f, 0);

                // Begin the scene. If this throws then we do not call EndScene.
                _device.BeginScene();

                // Render the scene. This should never throw.
                //_device.draw

                // End the scene.
                _device.EndScene();
                _device.Present();
            }

            catch (System.Exception e)
            {
                System.Console.WriteLine("Error 2842350084: {0}", e.Message);
            }
        }
 void _video_TextureReadyToRender(object sender, TextureRenderEventArgs e)
 {
     _device.BeginScene();
     _device.SetTexture(0, e.Texture);
     _device.VertexFormat = CustomVertex.PositionTextured.Format;
     _device.DrawUserPrimitives(PrimitiveType.TriangleList, 2, vertices);
     font.DrawText(null, "test overlay", 5, 5, Color.Red);
     _device.EndScene();
     _device.Present();
 }