Exemplo n.º 1
0
        /// <summary>
        /// Add your game rendering code here.
        /// </summary>
        /// <param name="e">Contains timing information.</param>
        /// <remarks>There is no need to call the base implementation.</remarks>
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            GL.Clear(ClearBufferMask.ColorBufferBit);

            //GL.Enable(EnableCap.Blend);
            //GL.Enable(EnableCap.PolygonSmooth);
            //GL.Disable(EnableCap.DepthTest);
            //glEnable(GL_BLEND);
            //glEnable(GL_POLYGON_SMOOTH);
            //glDisable(GL_DEPTH_TEST);


            GL.Begin(BeginMode.Triangles);


            GLHelper.Color3(PixelFarm.Drawing.Conv.ToColor(Color.MidnightBlue));
            GL.Vertex2(-1.0f, 1.0f);
            GLHelper.Color3(PixelFarm.Drawing.Conv.ToColor(Color.SpringGreen));
            GL.Vertex2(0.0f, -1.0f);
            GLHelper.Color3(PixelFarm.Drawing.Conv.ToColor(Color.Ivory));
            GL.Vertex2(1.0f, 1.0f);

            GL.End();

            this.SwapBuffers();
        }
Exemplo n.º 2
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            this.Title       = WindowTitle + "  FPS: " + (1f / e.Time).ToString("0.");
            MySphereZOffset += (float)(e.Time * 3.1);
            MySphereXOffset += (float)(e.Time * 4.2);
            #region Transform setup
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);
            // Camera
            GL.MatrixMode(MatrixMode.Modelview);
            Matrix4 mv = Matrix4.LookAt(EyePosition, Vector3.Zero, Vector3.UnitY);
            GL.LoadMatrix(ref mv);
            GL.Translate(0f, 0f, CameraZoom);
            GL.Rotate(CameraRotX, Vector3.UnitY);
            GL.Rotate(CameraRotY, Vector3.UnitX);
            #endregion Transform setup

            RenderCsg();
            // ---------------------------------

            if (ShowDebugWireFrame)
            {
                GLHelper.Color3(PixelFarm.Drawing.Color.LightGray);
                GL.Disable(EnableCap.StencilTest);
                GL.Disable(EnableCap.Lighting);
                //GL.Disable( EnableCap.DepthTest );
                GL.PolygonMode(MaterialFace.Front, PolygonMode.Line);
                DrawOperandB();
                GL.PolygonMode(MaterialFace.Front, PolygonMode.Fill);
                GL.Enable(EnableCap.DepthTest);
                GL.Enable(EnableCap.Lighting);
                GL.Enable(EnableCap.StencilTest);
            }
            this.SwapBuffers();
        }
 /// <summary>
 /// Add your game rendering code here.
 /// </summary>
 /// <param name="e">Contains timing information.</param>
 /// <remarks>There is no need to call the base implementation.</remarks>
 protected override void OnRenderFrame(FrameEventArgs e)
 {
     GL.Clear(ClearBufferMask.ColorBufferBit);
     GL.Begin(BeginMode.Triangles);
     GLHelper.Color3(PixelFarm.Drawing.Conv.ToColor(Color.MidnightBlue));
     GL.Vertex2(-1.0f, 1.0f);
     GLHelper.Color3(PixelFarm.Drawing.Conv.ToColor(Color.SpringGreen));
     GL.Vertex2(0.0f, -1.0f);
     GLHelper.Color3(PixelFarm.Drawing.Conv.ToColor(Color.Ivory));
     GL.Vertex2(1.0f, 1.0f);
     GL.End();
     this.SwapBuffers();
 }