private void DrawBatch(PrimitiveGroupEntry entry) { if (entry.VertexCount <= 0 && entry.IndexCount <= 0) { return; } // TODO: Add entry transform matrix GL.LineWidth(entry.LineWidth); // Apply texture var texture = textureFactory.GetTexture(entry.Texture ?? TextureId.White); if (texture == null) { return; } GL.BindTexture(TextureTarget.Texture2D, texture.PlatformTexture); // Draw geometry if (entry.IndexCount > 0) { GL.DrawElements(entry.PrimitiveType, entry.IndexCount, DrawElementsType.UnsignedShort, entry.StartIndex * sizeof(ushort)); } else { GL.DrawArrays(entry.PrimitiveType, entry.StartVertex, entry.VertexCount); } }
public void BeginPrimitive(PrimitiveType primitiveType, TextureId? texture, Matrix4x4? world = null, float lineWidth = 1) { if (hasPrimitiveBegin) throw new InvalidOperationException("Begin cannot be called until End has been successfully called."); hasPrimitiveBegin = true; currentPrimitive = new PrimitiveGroupEntry(); currentPrimitive.LineWidth = lineWidth; currentPrimitive.World = world; currentPrimitive.PrimitiveType = primitiveType; currentPrimitive.Texture = texture; currentPrimitive.StartVertex = currentVertex; currentPrimitive.StartIndex = currentIndex; currentBaseVertex = currentVertex; currentBaseIndex = currentIndex; beginSegment = currentSegment; isDirty = true; }
public void BeginPrimitive(PrimitiveType primitiveType, TextureId?texture, Matrix4x4?world = null, float lineWidth = 1) { if (hasPrimitiveBegin) { throw new InvalidOperationException("Begin cannot be called until End has been successfully called."); } hasPrimitiveBegin = true; currentPrimitive = new PrimitiveGroupEntry(); currentPrimitive.LineWidth = lineWidth; currentPrimitive.World = world; currentPrimitive.PrimitiveType = primitiveType; currentPrimitive.Texture = texture; currentPrimitive.StartVertex = currentVertex; currentPrimitive.StartIndex = currentIndex; currentBaseVertex = currentVertex; currentBaseIndex = currentIndex; beginSegment = currentSegment; isDirty = true; }
private void DrawBatch(PrimitiveGroupEntry entry) { if (entry.VertexCount <= 0 && entry.IndexCount <= 0) return; // TODO: Add entry transform matrix GL.LineWidth(entry.LineWidth); // Apply texture var texture = textureFactory.GetTexture(entry.Texture ?? TextureId.White); if (texture == null) return; GL.BindTexture(TextureTarget.Texture2D, texture.PlatformTexture); // Draw geometry if (entry.IndexCount > 0) { GL.DrawElements(entry.PrimitiveType, entry.IndexCount, DrawElementsType.UnsignedShort, entry.StartIndex * sizeof(ushort)); } else { GL.DrawArrays(entry.PrimitiveType, entry.StartVertex, entry.VertexCount); } }