public void Draw(GLGeometry Geometry, uint[] Indices, int Count, Action SetDataCallback, int IndicesOffset = 0) { Use(); SetDataCallback(); fixed(uint *IndicesPtr = &Indices[IndicesOffset]) { GL.glDrawElements((int)Geometry, Count, GL.GL_UNSIGNED_INT, IndicesPtr); } }
private void DrawVertices(GLGeometry type) { ShaderInfo.hasReversedNormal.NoWarning().Set(VertexType.ReversedNormal); _shader.Draw(type, _indicesList.Buffer, _indicesList.Length, () => { if (VertexType.HasPosition) { _verticesPositionBuffer.SetData(_verticesPosition.Buffer, 0, _verticesPosition.Length); ShaderInfo.vertexPosition.SetData <float>(_verticesPositionBuffer, 3, 0, sizeof(VertexInfoVector3F), false); } if (VertexType.HasTexture) { _verticesTexcoordsBuffer.SetData(_verticesTexcoords.Buffer, 0, _verticesTexcoords.Length); ShaderInfo.vertexTexCoords.SetData <float>(_verticesTexcoordsBuffer, 3, 0, sizeof(VertexInfoVector3F), false); } if (VertexType.HasColor) { _verticesColorsBuffer.SetData(_verticesColors.Buffer, 0, _verticesColors.Length); ShaderInfo.vertexColor.SetData <float>(_verticesColorsBuffer, 4, 0, sizeof(VertexInfoColor), false); } if (VertexType.HasNormal) { _verticesNormalBuffer.SetData(_verticesNormal.Buffer, 0, _verticesNormal.Length); ShaderInfo.vertexNormal.NoWarning() .SetData <float>(_verticesNormalBuffer, 4, 0, sizeof(VertexInfoVector3F), false); } if (VertexType.HasWeight) { _verticesWeightsBuffer.SetData(_verticesWeights.Buffer, 0, _verticesWeights.Length); var vertexWeights = new[] { ShaderInfo.vertexWeight0, ShaderInfo.vertexWeight1, ShaderInfo.vertexWeight2, ShaderInfo.vertexWeight3, ShaderInfo.vertexWeight4, ShaderInfo.vertexWeight5, ShaderInfo.vertexWeight6, ShaderInfo.vertexWeight7 }; for (var n = 0; n < VertexType.RealSkinningWeightCount; n++) { vertexWeights[n].SetData <float>(_verticesWeightsBuffer, 1, n * sizeof(float), sizeof(VertexInfoWeights), false); } } }); }
public void Draw(GLGeometry Geometry, uint[] Indices, int Count, Action SetDataCallback, int IndicesOffset = 0) { Use(); SetDataCallback(); fixed (uint* IndicesPtr = &Indices[IndicesOffset]) { GL.glDrawElements((int)Geometry, Count, GL.GL_UNSIGNED_INT, (void*)IndicesPtr); } }
public void Draw(GLGeometry Geometry, int Count, Action SetDataCallback, int Offset = 0) { Use(); SetDataCallback(); GL.glDrawArrays((int)Geometry, Offset, Count); }