public override GlCallResult GlRender() { return(GlRenderHandler.GlCall(() => { Mesh.GlRender(); }, true)); }
public override GlCallResult _glDispose() { return(GlRenderHandler.GlCall(() => { GL.DeleteBuffers(1, ref GlElementBuffer); GL.DeleteBuffers(Enum.GetNames(typeof(VertexBuffer)).Length, GlBuffers); GL.DeleteVertexArray(GlVao); })); }
public GlCallResult GlRender() { return(GlRenderHandler.GlCall(() => { GL.BindVertexArray(GlVao); GL.BindBuffer(BufferTarget.ElementArrayBuffer, GlElementBuffer); GL.DrawElements(PrimitiveType.Triangles, _numIndices, DrawElementsType.UnsignedInt, 0); GL.BindVertexArray(0); }, true)); }
public override GlCallResult _glInitialise() { return(GlRenderHandler.GlCall(() => { GlWrapModeX = TextureWrapMode.Repeat; GlWrapModeY = TextureWrapMode.Repeat; GlTextureMinFilter = new GlEventTextureFilter(TextureMagFilter.Linear); GlTextureMagFilter = new GlEventTextureFilter(TextureMagFilter.Linear); })); }
public override GlCallResult _glInitialise() { return(GlRenderHandler.GlCall(() => { GL.GenVertexArrays(1, out GlVao); GL.BindVertexArray(GlVao); // Element Buffer GL.GenBuffers(1, out GlElementBuffer); GL.BindBuffer(BufferTarget.ElementArrayBuffer, GlElementBuffer); GL.BufferData(BufferTarget.ElementArrayBuffer, _indices.Length * Marshal.SizeOf(typeof(uint)), _indices, BufferUsageHint.StaticDraw); _numIndices = _indices.Length; _indices = null; // Vertex Buffers var bufferLength = Enum.GetNames(typeof(VertexBuffer)).Length; GlBuffers = new uint[bufferLength]; GL.GenBuffers(bufferLength, GlBuffers); GL.BindBuffer(BufferTarget.ArrayBuffer, GlBuffers[(int)VertexBuffer.Pos]); #if DEBUG var result = GlBufferData(); if (!result.Synchronised) { throw new InvalidAsynchronousStateException("GlBufferData() should be executing synchronised."); } #else GlBufferData(); #endif GL.EnableVertexAttribArray((int)VertexBuffer.Pos); GL.VertexAttribPointer((int)VertexBuffer.Pos, _dimensions, VertexAttribPointerType.Float, false, 0, 0); GL.BindVertexArray(0); })); }
public override GlCallResult _glDispose() { return(GlRenderHandler.GlCall(() => { })); }
public override GlCallResult _glInitialise() { return(GlRenderHandler.GlCall(() => { })); }