mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2026-08-15 02:57:49 +04:00
gl viewport
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using Silk.NET.OpenGL;
|
||||
|
||||
namespace NResUI.Rendering.Viewport.Meshes;
|
||||
|
||||
public sealed class GpuMesh
|
||||
{
|
||||
private readonly GL _gl;
|
||||
|
||||
public uint VertexArrayObject { get; }
|
||||
public uint VertexBufferObject { get; }
|
||||
public uint ElementBufferObject { get; }
|
||||
public uint IndexCount { get; }
|
||||
public PrimitiveType PrimitiveType { get; }
|
||||
|
||||
public GpuMesh(
|
||||
GL gl,
|
||||
uint vertexArrayObject,
|
||||
uint vertexBufferObject,
|
||||
uint elementBufferObject,
|
||||
uint indexCount,
|
||||
PrimitiveType primitiveType = PrimitiveType.Triangles)
|
||||
{
|
||||
_gl = gl;
|
||||
VertexArrayObject = vertexArrayObject;
|
||||
VertexBufferObject = vertexBufferObject;
|
||||
ElementBufferObject = elementBufferObject;
|
||||
IndexCount = indexCount;
|
||||
PrimitiveType = primitiveType;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
_gl.BindVertexArray(VertexArrayObject);
|
||||
_gl.DrawElements(PrimitiveType, IndexCount, DrawElementsType.UnsignedInt, null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user