public void Draw() { Vertex2f[] vertices = new Vertex2f[] { new Vertex2f(0.0f, 0.0f), new Vertex2f(1.0f, 0.0f), new Vertex2f(1.0f, 1.0f), new Vertex2f(0.0f, 1.0f), }; using (VertexArrayObject vao = new VertexArrayObject()) { // Setup ABO (Position) ArrayBufferObject abo = new ArrayBufferObject(VertexBaseType.Float, 2, BufferObjectHint.StaticCpuDraw); abo.Create(vertices); // Setup VAO vao.SetArray(abo, VertexArraySemantic.Position); vao.SetElementArray(PrimitiveType.TriangleStrip); vao.Create(_Context); using (State.GraphicsStateSet currentState = State.GraphicsStateSet.GetDefaultSet()) { // Set transform state State.TransformStateBase stateTransform = (State.TransformStateBase)currentState[State.TransformStateBase.StateId]; // Set normalized orthogonal projection stateTransform.LocalProjection = new OrthoProjectionMatrix(0.0f, 1.0f, 0.0f, 1.0f); // Apply state currentState.Apply(_Context); // Draw Assert.DoesNotThrow(delegate() { vao.Draw(_Context); }); } } }
/// <summary> /// Determine whether this bound volume is clipped by all specified planes. /// </summary> /// <param name="clippingPlanes"> /// A <see cref="IEnumerable{Plane}"/> that are used to perform geometry clipping. /// </param> /// <returns> /// It returns a boolean value indicating whether this bound volume is entirely /// clipped by <paramref name="clippingPlanes"/>. /// </returns> public bool IsClipped(IEnumerable <Plane> clippingPlanes, State.TransformStateBase objectModel) { Vertex3f sphereOrigin = (Vertex3f)objectModel.ModelView.Position; foreach (Plane plane in clippingPlanes) { if (plane.GetDistance(sphereOrigin) < _Radius) { return(true); } } return(false); }