public bool Link() { GlHelper.ThrowNullException(Id); Gl.LinkProgram(Id); GlHelper.GetError(); return(Status); }
public static void Create(Texture[] textures, int index, int count) { if (textures == null) { throw new ArgumentNullException("textures"); } if (index < 0) { throw new ArgumentOutOfRangeException("index", index, "index is less than 0."); } if (index + count > textures.Length) { throw new ArgumentOutOfRangeException("count", count, "index + count is greater than textures.Length."); } if (count < 0) { throw new ArgumentOutOfRangeException("count", count, "count is less than 0."); } unsafe { uint *ids = stackalloc uint[count]; Gl.GenTextures(count, ids); GlHelper.GetError(); for (int i = 0; i < count; ++i) { var texture = new Texture(); texture.Id = ids[i]; textures[index + i] = texture; } } }
public bool Compile() { GlHelper.ThrowNullException(Id); Gl.CompileShader(Id); GlHelper.GetError(); return(Status); }
public static void Create(Query[] queries, int index, int count) { if (queries == null) { throw new ArgumentNullException("queries"); } if (index < 0) { throw new ArgumentOutOfRangeException("index", index, "index is less than 0."); } if (index + count > queries.Length) { throw new ArgumentOutOfRangeException("count", count, "index + count is greater than queries.Length."); } if (count < 0) { throw new ArgumentOutOfRangeException("count", count, "count is less than 0."); } unsafe { uint *ids = stackalloc uint[count]; Gl.GenQueries(count, ids); GlHelper.GetError(); for (int i = 0; i < count; ++i) { var query = new Query(); query.Id = ids[i]; queries[index + i] = query; } } }
public static void Create(VertexArray[] arrays, int index, int count) { if (arrays == null) { throw new ArgumentNullException("arrays"); } if (index < 0) { throw new ArgumentOutOfRangeException("index", index, "index is less than 0."); } if (index + count > arrays.Length) { throw new ArgumentOutOfRangeException("count", count, "index + count is greater than arrays.Length."); } if (count < 0) { throw new ArgumentOutOfRangeException("count", count, "count is less than 0."); } unsafe { uint *ids = stackalloc uint[count]; Gl.GenVertexArrays(count, ids); GlHelper.GetError(); for (int i = 0; i < count; ++i) { var array = new VertexArray(); array.Id = ids[i]; arrays[index + i] = array; } } }
public static void Create(Buffer[] buffers, int index, int count) { if (buffers == null) { throw new ArgumentNullException("buffers"); } if (index < 0) { throw new ArgumentOutOfRangeException("index", index, "index is less than 0."); } if (index + count > buffers.Length) { throw new ArgumentOutOfRangeException("count", count, "index + count is greater than buffers.Length."); } if (count < 0) { throw new ArgumentOutOfRangeException("count", count, "count is less than 0."); } unsafe { uint *ids = stackalloc uint[count]; Gl.GenBuffers(count, ids); GlHelper.GetError(); for (int i = 0; i < count; ++i) { var buffer = new Buffer(); buffer.Id = ids[i]; buffers[index + i] = buffer; } } }
public void VertexAttributePointer(int size, DataType type, bool normalized, int stride, int offset) { unsafe { Gl.VertexAttribPointer(Index, size, (uint)type, (byte)(normalized ? 1 : 0), stride, (void *)offset); GlHelper.GetError(); } }
public static void SetUniform(int location, Ibasa.Numerics.Matrix4x3f value) { unsafe { Gl.UniformMatrix4x3fv(location, 1, 0, (float *)(&value)); GlHelper.GetError(); } }
public static void SetUniform(int location, Ibasa.Interop.UnmanagedArray <Ibasa.Numerics.Vector4ui> value) { unsafe { Gl.Uniform4uiv(location, value.Count, (uint *)value.Pointer.ToPointer()); GlHelper.GetError(); } }
public static void SetUniform(int location, Ibasa.Interop.UnmanagedArray <int> value) { unsafe { Gl.Uniform1iv(location, value.Count, (int *)value.Pointer.ToPointer()); GlHelper.GetError(); } }
public void GetBufferSubData(long offset, long size, IntPtr data) { unsafe { Gl.GetBufferSubData(Target, (void *)offset, (void *)size, data.ToPointer()); GlHelper.GetError(); } }
public void BufferData(long size, IntPtr data, Usage usage) { unsafe { Gl.BufferData(Target, (void *)size, data.ToPointer(), (uint)usage); GlHelper.GetError(); } }
public static void SetUniform(int location, Ibasa.Interop.UnmanagedArray <Ibasa.Numerics.Matrix4x3f> value) { unsafe { Gl.UniformMatrix4x3fv(location, value.Count, 0, (float *)value.Pointer.ToPointer()); GlHelper.GetError(); } }
public static void DrawElements(PrimitiveTopology topology, int count, DataType type, int offset, int basevertex) { unsafe { Gl.DrawElementsBaseVertex((uint)topology, count, (uint)type, (void *)offset, basevertex); GlHelper.GetError(); } }
public static void DrawElements(PrimitiveTopology topology, int count, DataType type, IntPtr indices, int basevertex) { unsafe { Gl.DrawElementsBaseVertex((uint)topology, count, (uint)type, indices.ToPointer(), basevertex); GlHelper.GetError(); } }
public void Delete() { GlHelper.ThrowNullException(Id); unsafe { uint id = Id; Gl.DeleteVertexArrays(1, &id); } }
public IntPtr Map(MapAccess access) { unsafe { var result = Gl.MapBuffer(Target, (uint)access); GlHelper.GetError(); return(new IntPtr(result)); } }
public static Sync Fence() { unsafe { var handle = Gl.FenceSync(Gl.SYNC_GPU_COMMANDS_COMPLETE, 0); GlHelper.GetError(); return(new Sync(new IntPtr(handle))); } }
public override bool Equals(object obj) { GlHelper.ThrowNullException(Target); if (obj is TextureBinding) { return(Equals((TextureBinding)obj)); } return(false); }
public override bool Equals(object obj) { GlHelper.ThrowNullException(Id); if (obj is VertexArray) { return(Equals((VertexArray)obj)); } return(false); }
public override bool Equals(object obj) { GlHelper.ThrowNullException(Handle); if (obj is Sync) { return(Equals((Sync)obj)); } return(false); }
public override bool Equals(object obj) { GlHelper.ThrowNullException(Id); if (obj is Shader) { return(Equals((Shader)obj)); } return(false); }
public void Delete() { GlHelper.ThrowNullException(Id); unsafe { uint id = Id; Gl.DeleteBuffers(1, &id); } }
public void Unmap() { bool result = Gl.UnmapBuffer(Target) != 0; GlHelper.GetError(); if (!result) { throw new OpenGLException("glUnmapBuffer returned false."); } }
public void Delete() { unsafe { GlHelper.ThrowNullException(Handle); Gl.DeleteSync(Handle.ToPointer()); Handle = IntPtr.Zero; GlHelper.GetError(); } }
public static Shader Create(ShaderType type) { unsafe { uint id = Gl.CreateShader((uint)type); GlHelper.GetError(); var shader = new Shader(); shader.Id = id; return(shader); } }
public static Program Create() { unsafe { uint id = Gl.CreateProgram(); GlHelper.GetError(); var program = new Program(); program.Id = id; return(program); } }
public static Texture Create() { unsafe { uint id; Gl.GenTextures(1, &id); GlHelper.GetError(); var texture = new Texture(); texture.Id = id; return(texture); } }
public static Buffer Create() { unsafe { uint id; Gl.GenBuffers(1, &id); GlHelper.GetError(); var buffer = new Buffer(); buffer.Id = id; return(buffer); } }
public static VertexArray Create() { unsafe { uint id; Gl.GenVertexArrays(1, &id); GlHelper.GetError(); var array = new VertexArray(); array.Id = id; return(array); } }