/// <summary> Called by render list and executes the operation </summary> public override void Execute(GLMatrixCalc c) { GLScissors.Disable(viewport); }
/// <summary> /// Called by an override to GLWinFormControl Paint or other to render the controls /// </summary> /// <param name="currentstate">Render state</param> /// <param name="ts">Time stamp from Paint</param> public void Render(GLRenderState currentstate, ulong ts) { System.Diagnostics.Debug.Assert(context == GLStatics.GetContext() && IsCurrent(), "Context incorrect"); //System.Diagnostics.Debug.WriteLine("Render"); NeedRedraw = false; RequestRender = false; if (ControlsIZ.Count > 0) // only action if children present { bool altscalechanged = false; foreach (var c in ControlsIZ) { if (c.Visible) { //System.Diagnostics.Debug.WriteLine("Draw " + c.Name); bool redrawn = c.Redraw(null, new Rectangle(0, 0, 0, 0), new Rectangle(0, 0, 0, 0), false); // see if redraw done if (redrawn) { // System.Diagnostics.Debug.WriteLine($"texture changed refresh GL {c.Name} {c.Size} {c.LevelBitmap.Size}"); textures[c].CreateLoadBitmap(c.LevelBitmap, SizedInternalFormat.Rgba8); // and update texture unit with new bitmap //float[] p = textures[c].GetTextureImageAsFloats(end:100); } if (c.TopLevelControlUpdate) { c.TopLevelControlUpdate = false; altscalechanged = true; } } } if (altscalechanged) { UpdateVertexPositionsTextures(); // we need to update.. } GLScissors.SetToScreenCoords(0, MatrixCalc); shader.Start(MatrixCalc); ri.Bind(currentstate, shader, MatrixCalc); // binds VA AND the element buffer ri.Render(); // draw using primitive restart on element index buffer with bindless textures shader.Finish(); GL.UseProgram(0); // final clean up GL.BindProgramPipeline(0); GLScissors.Disable(0); GLStatics.Check(); foreach (var c in ControlsIZ) { var form = c as GLForm; if (form != null && form.FormShown == false) { form.OnShown(); form.FormShown = true; } } } //System.Diagnostics.Debug.WriteLine("Render Finished"); }