Example #1
0
        /// <summary>
        /// Renders everything
        /// </summary>
        /// <param name="e">event arg passed to us by opentk</param>
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            if (_running)
            {
                GL.Clear(ClearBufferMask.ColorBufferBit);

                //TODO: Draw the background here

                //Draw fruit
                _fruitShader.Bind();
                _fruitTexture.Bind();
                _fruit.Draw();

                //Draw the body of the snake
                _snakeShader.Bind();
                for (int i = 0; i < _snake.Count; i++)
                {
                    _snake[i].Draw();
                }
                //Draw the head of the snake
                _snakeHeadShader.Bind();
                _snakeHeadTexture.Bind();
                _snakeHead.Draw();

                Context.SwapBuffers();
            }

            base.OnRenderFrame(e);
        }
Example #2
0
 private void Form1_Paint(object sender, PaintEventArgs e)
 {
     head.Draw(e.Graphics);
 }