void glCanvas1_OpenGLDraw(object sender, PaintEventArgs e) { GL.ClearColor(0x87 / 255.0f, 0xce / 255.0f, 0xeb / 255.0f, 0xff / 255.0f); GL.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); var arg = new RenderEventArgs(RenderModes.Render, this.camera); switch (this.renderOrder) { case RenderOrder.Increase: element.Render(arg); break; case RenderOrder.Decrease: elementReversed.Render(arg); break; case RenderOrder.IncreaseThenDecrease: element.Render(arg); elementReversed.Render(arg); break; case RenderOrder.DecreaseThenIncrease: elementReversed.Render(arg); element.Render(arg); break; default: throw new NotImplementedException(); } }
void glCanvas1_OpenGLDraw(object sender, PaintEventArgs e) { GL.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); var arg = new RenderEventArgs(RenderModes.Render, this.camera); mat4 projectionMatrix = camera.GetProjectionMat4(); mat4 viewMatrix = camera.GetViewMat4(); mat4 modelMatrix = mat4.identity(); mat4 mvp = projectionMatrix * viewMatrix * modelMatrix; switch (this.renderOrder) { case RenderOrder.Increase: element.mvp = mvp; element.Render(arg); break; case RenderOrder.Decrease: elementReversed.mvp = mvp; elementReversed.Render(arg); break; case RenderOrder.IncreaseThenDecrease: element.mvp = mvp; elementReversed.mvp = mvp; element.Render(arg); elementReversed.Render(arg); break; case RenderOrder.DecreaseThenIncrease: elementReversed.mvp = mvp; element.mvp = mvp; elementReversed.Render(arg); element.Render(arg); break; default: throw new NotImplementedException(); } }