Esempio n. 1
0
        private void winGLCanvas1_OpenGLDraw(object sender, PaintEventArgs e)
        {
            ActionList list = this.actionList;

            if (list != null)
            {
                vec4 clearColor = this.scene.ClearColor;
                GL.Instance.ClearColor(clearColor.x, clearColor.y, clearColor.z, clearColor.w);
                GL.Instance.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT);

                list.Act(new ActionParams(Viewport.GetCurrent()));
            }
        }
Esempio n. 2
0
        private void winGLCanvas1_OpenGLDraw(object sender, PaintEventArgs e)
        {
            ActionList list = this.actionList;

            if (list != null)
            {
                list.Act(new ActionParams(Viewport.GetCurrent()));
            }
            {
                DirectTextNode node = this.textNode;
                if (node != null)
                {
                    GL.Instance.DrawText(node.Position.X, node.Position.Y, node.TextColor, node.FontName, node.FontSize, node.Text);
                }
            }
        }
Esempio n. 3
0
        private void winGLCanvas2_OpenGLDraw(object sender, PaintEventArgs e)
        {
            var canvas = sender as WinGLCanvas;

            canvas.MakeCurrent();
            ActionList list = this.actionList2;

            if (list != null)
            {
                vec4 clearColor = this.scene2.ClearColor;
                GL.Instance.ClearColor(clearColor.x, clearColor.y, clearColor.z, clearColor.w);
                GL.Instance.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT);

                Viewport viewport = Viewport.GetCurrent();
                list.Act(new ActionParams(viewport));
            }
        }
Esempio n. 4
0
        private void winGLCanvas1_OpenGLDraw(object sender, PaintEventArgs e)
        {
            ActionList list = this.actionList;

            if (list != null)
            {
                vec4 clearColor = this.scene.ClearColor;
                GL.Instance.ClearColor(clearColor.x, clearColor.y, clearColor.z, clearColor.w);
                GL.Instance.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT);

                list.Act(new ActionParams(Viewport.GetCurrent()));

                DirectTextNode node = this.textNode;
                if (node != null)
                {
                    GL.Instance.DrawText(node.Position.X, node.Position.Y, node.TextColor, node.FontName, node.FontSize, node.Text);
                }
            }
        }
Esempio n. 5
0
        private void winGLCanvas1_OpenGLDraw(object sender, PaintEventArgs e)
        {
            ActionList list = this.actionList;

            if (list != null)
            {
                //vec4 clearColor = this.scene.ClearColor;
                //GL.Instance.ClearColor(clearColor.x, clearColor.y, clearColor.z, clearColor.w);
                GL.Instance.ClearColor(0, 0, 0, 0);
                GL.Instance.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT);

                query.BeginQuery(QueryTarget.SamplesPassed);
                {
                    list.Act(new ActionParams(Viewport.GetCurrent()));
                }
                query.EndQuery(QueryTarget.SamplesPassed);
                int sampleCount = this.query.SampleCount();
                this.lblSampleCount.Text = string.Format("Sample Passed: {0}", sampleCount);
            }
        }
Esempio n. 6
0
 private void winGLCanvas1_OpenGLDraw(object sender, PaintEventArgs e) // draw code
 {
     try
     {
         ActionList list = actionlist;
         if (list != null)
         {
             vec4 clearColor = scene.ClearColor;
             GL.Instance.ClearColor(clearColor.x, clearColor.y, clearColor.z, clearColor.w);
             GL.Instance.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT);
             list.Act(new ActionParams(Viewport.GetCurrent())); // fixed
             if (!nodbg)                                        // nodbg will toggle this
             {
                 string tasks = "Tasks: ";
                 foreach (object i in list)
                 {
                     tasks += $"{i.GetType().Name} ";
                 }
                 GL.Instance.DrawText(10, 58, Color.Red, "Verdana", 12, $"RAM Usage (no gc): {GC.GetTotalMemory(false)/1024}");
                 GL.Instance.DrawText(10, 22, Color.Red, "Verdana", 12, "List Size: " + list.Count);
                 GL.Instance.DrawText(10, 34, Color.Red, "Verdana", 12, tasks);
                 GL.Instance.DrawText(10, 10, Color.Red, "Verdana", 12, "FPS: " + winGLCanvas1.FPS.ToString() + " Time " + (DateTime.Now - time).Seconds);
             }
             if (StatusmessageEnabled)
             {
                 GL.Instance.DrawText(10, 34, Color.White, "Verdana", 24, Statusmessage);
             }
         }
     } catch (Exception ex)
     {
         if (throwFatalInsteadOfMsg)
         {
             throw;
         }
         GameFatal gf = new GameFatal(ex);
         gf.Show();
     }
 }
Esempio n. 7
0
        private void winGLCanvas1_OpenGLDraw(object sender, PaintEventArgs e)
        {
            ActionList list = this.actionList;

            if (list != null)
            {
                vec4 clearColor = this.scene.ClearColor;
                GL.Instance.ClearColor(clearColor.x, clearColor.y, clearColor.z, clearColor.w);
                GL.Instance.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT);

                int width = this.winGLCanvas1.Width, height = this.winGLCanvas1.Height;
                //    var scissor = new int[4];
                //    var viewport = new int[4];
                //    GL.Instance.GetIntegerv((uint)GetTarget.ScissorBox, scissor);
                //    GL.Instance.GetIntegerv((uint)GetTarget.Viewport, viewport);

                Viewport viewport = Viewport.GetCurrent();
                list.Act(new ActionParams(viewport));

                // Reset viewport.
                GL.Instance.Scissor(0, 0, width, height);
                GL.Instance.Viewport(0, 0, width, height);
            }
        }