public void Draw(object sender, OpenGLEventArgs args) { GL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); // Add gradient background. SetVerticalGradientBackground(GL, new ColorF(255, 146, 134, 188), new ColorF(1f, 0, 1, 0)); NmProgram.BindAll(GL); }
public void Draw(object sender, OpenGLEventArgs args) { foreach (var act in _runOnNextDraw) { act.Invoke(); } _runOnNextDraw.Clear(); GL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); // Add gradient background. SetVerticalGradientBackground(GL, new ColorF(255, 146, 134, 188), new ColorF(1f, 0, 1, 0)); NmProgram.BindAll(GL); }
public void Draw(object sender, OpenGLEventArgs args) { var scene = sender as OpenGLControlJOG; if (NmProgram.ChangedUniforms.Count == 0) // Prepare HitTest scene { // Prevent the image from updating, so that the hittest id's won't be visible to the user. if (HtProgram.ChangedUniforms.Count != 0) { scene.RefreshImgSource = false; GL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); HtProgram.BindAll(GL); } else { // Prevent blitting the image when nothing changed. scene.BlitImage = false; } } else // Update the visual scene. { if (!scene.RefreshImgSource) { scene.RefreshImgSource = true; } if (!scene.BlitImage) { scene.BlitImage = true; } GL.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); // Add gradient background. SetVerticalGradientBackground(GL, new ColorF(255, 146, 134, 188), new ColorF(1f, 0, 1, 0)); NmProgram.BindAll(GL); } }