Exemple #1
0
 public override bool Begin(gdi.Color color)
 {
     if (stateDraw)
     {
         return(false);
     }
     Begin();
     Opengl32.glClearColor(color.R / 255f, color.G / 255f, color.B / 255f, color.A / 255f);
     Opengl32.glClear(GLConsts.GL_COLOR_BUFFER_BIT);
     ctx.Resize();
     return(true);
 }
Exemple #2
0
        void render(float dt)
        {
            animationTime += dt;

            if (timerLog)
            {
                Console.WriteLine("Set clear Color");
            }
            Opengl32.glClearColor(0, 0, 0, 1);
            if (timerLog)
            {
                Console.WriteLine("Clear Screen");
            }
            Opengl32.glClear(GLConsts.GL_COLOR_BUFFER_BIT);

            pgl.Opengl32.glLoadIdentity();
            float cx = (float)Math.Cos(animationTime);
            float sx = (float)Math.Sin(animationTime);

            pgl.Opengl32.glLoadMatrixf(new float[] {
                cx, sx, 0, 0,
                -sx, cx, 0, 0,
                0, 0, 1, 0,
                0, 0, 0, 1
            });
            if (timerLog)
            {
                Console.WriteLine("Begin triangle");
            }
            pgl.GL.Begin(PrimitiveType.TRIANGLES);
            pgl.GL.Color(Color.Yellow);
            pgl.GL.Vertex2(0, -.75f);
            pgl.GL.Color(Color.Green);
            pgl.GL.Vertex2(.75f, .75f);
            pgl.GL.Color(Color.Red);
            pgl.GL.Vertex2(-.75f, .75f);
            pgl.GL.End();
            if (timerLog)
            {
                Console.WriteLine("Ended Triangle");
            }

            if (timerLog)
            {
                Console.WriteLine("Swap Buffer");
            }
            ctx.SwapBuffer();
            timerLog = false;
        }
Exemple #3
0
 public override void Begin()
 {
     FBO.Bind();
     Opengl32.glClear(GLConsts.GL_COLOR_BUFFER_BIT);
 }