private void DoRender(vec3 lineColor) { polygonModeState.On(); GL.Instance.Begin((uint)DrawMode.Quads); GL.Instance.Color3f(lineColor.x, lineColor.y, lineColor.z); for (int i = 0; i < indexes.Length; i++) { vec3 position = positions[indexes[i]]; GL.Instance.Vertex3f(position.x, position.y, position.z); } GL.Instance.End(); polygonModeState.Off(); }
public void RenderBeforeChildren(RenderEventArgs arg) { if (!this.IsInitialized) { this.Initialize(); } this.RotationAngle += this.RotateSpeed; ICamera camera = arg.Camera; mat4 projection = camera.GetProjectionMatrix(); mat4 view = camera.GetViewMatrix(); mat4 model = this.GetModelMatrix(); var method = this.RenderUnit.Methods[0]; // the only render unit in this node. ShaderProgram program = method.Program; program.SetUniform(projectionMatrix, projection); program.SetUniform(viewMatrix, view); program.SetUniform(modelMatrix, model); if (this.RenderWireframe) { // render wireframe. program.SetUniform("renderWireframe", true); polygonMode.On(); polygonOffsetState.On(); method.Render(); polygonOffsetState.Off(); polygonMode.Off(); } if (this.RenderBody) { // render solid body. program.SetUniform("renderWireframe", false); method.Render(); } }