void IRenderable.EnqueueDrawCalls(GLDrawCallBatch drawCallbatch) { if (_vertexArrayObjects == null) { _vertexArrayObjects = Model.GLMeshes.Select(glMesh => { var vao = new GLVertexArrayObject(glMesh, Material.Program); vao.GpuAllocateDeferred(); return(vao); }).ToArray(); } for (var i = 0; i < Model.GLMeshes.Length; i++) { var glMesh = Model.GLMeshes[i]; drawCallbatch.AddDrawCall(new GLDrawCall( Material.Program, Material.GenerateTexturebinds(), _vertexArrayObjects[i], Material.GenerateUniformBinds(Transform.GetWorldMatrix()), () => GL.DrawElements(PrimitiveType.Triangles, glMesh.IndexBuffer.BufferCount, DrawElementsType.UnsignedInt, IntPtr.Zero))); } }
public void EnqueueDrawCalls(GLDrawCallBatch drawCallbatch) { if (_vertexArrayObject == null) { _vertexArrayObject = new GLVertexArrayObject(_glMesh, _textMaterial.Program); _vertexArrayObject.GpuAllocateDeferred(); } drawCallbatch.AddDrawCall(new GLDrawCall( _textMaterial.Program, _textMaterial.GenerateTexturebinds(), _vertexArrayObject, _textMaterial.GenerateUniformBinds(Transform.GetWorldMatrix()), () => GL.DrawElements(PrimitiveType.Triangles, _glMesh.IndexBuffer.BufferCount, DrawElementsType.UnsignedInt, IntPtr.Zero))); }
public void EnqueueDrawCalls(GLDrawCallBatch drawCallbatch) { using (var graphics = Graphics.FromImage(_glTexture.Bitmap)) { graphics.Clear(Color.Transparent); graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; Draw(graphics); } if (_vertexArrayObject == null) { _vertexArrayObject = new GLVertexArrayObject(_glMesh, _guiShader); _vertexArrayObject.GpuAllocateDeferred(); } drawCallbatch.AddDrawCall(new GLDrawCall(_guiShader, new[] { new GLDrawCall.GLTextureBind(_glTexture, TextureTarget.Texture2D, TextureUnit.Texture0) }, _vertexArrayObject, new GLDrawCall.UniformBind[0], () => GL.DrawElements(PrimitiveType.Triangles, _glMesh.IndexBuffer.BufferCount, DrawElementsType.UnsignedInt, IntPtr.Zero))); }