Пример #1
0
 internal static void VerifyParametersDrawIndexed(PrimitiveType primitiveType, Shader shader, VertexBuffer vertexBuffer, IndexBuffer indexBuffer, int startIndex, int indicesCount)
 {
     shader.VerifyNotDisposed();
     vertexBuffer.VerifyNotDisposed();
     indexBuffer.VerifyNotDisposed();
     if (shader == null)
     {
         throw new ArgumentNullException("shader");
     }
     if (vertexBuffer == null)
     {
         throw new ArgumentNullException("vertexBuffer");
     }
     if (indexBuffer == null)
     {
         throw new ArgumentNullException("indexBuffer");
     }
     if (startIndex < 0 || indicesCount < 0 || startIndex + indicesCount > indexBuffer.IndicesCount)
     {
         throw new ArgumentException("Indices range is out of bounds.");
     }
 }
Пример #2
0
 public static void DrawIndexed(PrimitiveType primitiveType, Shader shader, VertexBuffer vertexBuffer, IndexBuffer indexBuffer, int startIndex, int indicesCount)
 {
     VerifyParametersDrawIndexed(primitiveType, shader, vertexBuffer, indexBuffer, startIndex, indicesCount);
     GLWrapper.ApplyRenderTarget(RenderTarget);
     GLWrapper.ApplyViewportScissor(Viewport, ScissorRectangle, RasterizerState.ScissorTestEnable);
     GLWrapper.ApplyShaderAndBuffers(shader, vertexBuffer.VertexDeclaration, IntPtr.Zero, vertexBuffer.m_buffer, indexBuffer.m_buffer);
     GLWrapper.ApplyRasterizerState(RasterizerState);
     GLWrapper.ApplyDepthStencilState(DepthStencilState);
     GLWrapper.ApplyBlendState(BlendState);
     GL.DrawElements(GLWrapper.TranslatePrimitiveType(primitiveType), indicesCount, GLWrapper.TranslateIndexFormat(indexBuffer.IndexFormat), new IntPtr(startIndex * indexBuffer.IndexFormat.GetSize()));
 }
Пример #3
0
 public IndexBufferAndCount(IndexBuffer buffer, int indexCount)
 {
     Buffer     = buffer;
     IndexCount = indexCount;
 }