public void Render() { var matrix = _viewMatrix.GetMatrix(); matrix.Column3 = Vector4.UnitW; _shader.Use(); _shader.View = matrix; _shader.Projection = _projectionMatrix.GetMatrix(); _vertexArray.Bind(); _vertexArray.Render(PrimitiveType.Lines); }
/// <summary> /// 创建元素堆 /// </summary> /// <param name="vertexArray">顶点堆</param> /// <param name="elements">元素堆</param> public ElementArray(IVertexArrayHandle vertexArray, IEnumerable <uint> elements) { _elements = elements.ToArray(); _count = _elements.Length; _vertexArrayHandle = vertexArray; _vertexArrayHandle.Bind(); _elementBufferObject = GL.GenBuffer(); GL.BindBuffer(BufferTarget.ElementArrayBuffer, _elementBufferObject); GL.BufferData(BufferTarget.ElementArrayBuffer, _elements.Length * sizeof(uint), _elements, BufferUsageHint.StaticDraw); //_logger.Info($"Create an element array:{_elementBufferObject}"); }
public void Bind() { _texture.Bind(); _vertexArrayHandle.Bind(); }