daily update on 20231113 by nitload youmu, upgrade gl loader complete
This commit is contained in:
@@ -16,7 +16,7 @@ namespace StgSharp.Graphics
|
||||
_bufferID = new uint[n];
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.gl->GenBuffers(n, id);
|
||||
GL.gl.GenBuffers(n, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,14 +27,14 @@ namespace StgSharp.Graphics
|
||||
|
||||
public void Bind(int index)
|
||||
{
|
||||
GL.gl->BindBuffer(GLconst.ELEMENT_ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.gl.BindBuffer(GLconst.ELEMENT_ARRAY_BUFFER, _bufferID[index]);
|
||||
}
|
||||
|
||||
|
||||
public void SetData<T>(int index, T[] bufferArray, BufferUsage usage)
|
||||
where T : struct, IConvertible
|
||||
{
|
||||
GL.gl->BindBuffer(GLconst.ELEMENT_ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.gl.BindBuffer(GLconst.ELEMENT_ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.gl->DeleteBuffers(1, id);
|
||||
GL.gl.DeleteBuffers(1, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,19 +13,19 @@ namespace StgSharp.Graphics
|
||||
|
||||
public unsafe Shader()
|
||||
{
|
||||
programID = GL.gl->CreateProgram();
|
||||
programID = GL.gl.CreateProgram();
|
||||
}
|
||||
|
||||
public unsafe void CompileVertexShader(string shaderCode)
|
||||
{
|
||||
vertexShaderID = GL.CompileShader(shaderCode, ShaderType.VERTEX);
|
||||
GL.gl->AttachShader(programID, vertexShaderID);
|
||||
GL.gl.AttachShader(programID, vertexShaderID);
|
||||
}
|
||||
|
||||
public unsafe void CompileFragmentShader(string shaderCode)
|
||||
{
|
||||
fragmentShaderID = GL.CompileShader(shaderCode, ShaderType.FRAGMENT);
|
||||
GL.gl->AttachShader(programID, fragmentShaderID);
|
||||
GL.gl.AttachShader(programID, fragmentShaderID);
|
||||
}
|
||||
|
||||
public void Link()
|
||||
@@ -50,7 +50,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
public unsafe void Use()
|
||||
{
|
||||
GL.gl->UseProgram(programID);
|
||||
GL.gl.UseProgram(programID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace StgSharp.Graphics
|
||||
_bufferID = new uint[n];
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.gl->GenVertexArrays(n, id);
|
||||
GL.gl.GenVertexArrays(n, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,21 +27,21 @@ namespace StgSharp.Graphics
|
||||
|
||||
public void Bind(int index)
|
||||
{
|
||||
GL.gl->BindVertexArray(_bufferID[index]);
|
||||
GL.gl.BindVertexArray(_bufferID[index]);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.gl->DeleteVertexArrays(_bufferID.Length, id);
|
||||
GL.gl.DeleteVertexArrays(_bufferID.Length, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetVertexAttribute(uint index, int vertexLength, Type dataType, bool isNomalized, int stride, int pointer)
|
||||
{
|
||||
GL.gl->VertexAttribPointer(
|
||||
GL.gl.VertexAttribPointer(
|
||||
index, vertexLength, InternalIO.GLtype[dataType],
|
||||
isNomalized,
|
||||
stride, (void*)pointer);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace StgSharp.Graphics
|
||||
_bufferID = new uint[n];
|
||||
fixed (uint* ptr = _bufferID)
|
||||
{
|
||||
GL.gl->GenBuffers(n, ptr);
|
||||
GL.gl.GenBuffers(n, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,19 +31,19 @@ namespace StgSharp.Graphics
|
||||
/// </summary>
|
||||
public static void Unbind()
|
||||
{
|
||||
GL.gl->BindBuffer(GLconst.ARRAY_BUFFER, 0);
|
||||
GL.gl.BindBuffer(GLconst.ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
public void Bind(int index)
|
||||
{
|
||||
GL.gl->BindBuffer(GLconst.ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.gl.BindBuffer(GLconst.ARRAY_BUFFER, _bufferID[index]);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.gl->DeleteBuffers(_bufferID.Length, id);
|
||||
GL.gl.DeleteBuffers(_bufferID.Length, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,14 +55,14 @@ namespace StgSharp.Graphics
|
||||
/// <param name="readType"></param>
|
||||
public void SetData<T>(int index, T bufferData, BufferUsage usage) where T : IMat
|
||||
{
|
||||
GL.gl->BindBuffer((int)BufferType.ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.gl.BindBuffer((int)BufferType.ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferData, usage);
|
||||
|
||||
}
|
||||
|
||||
public void SetDataArray<T>(int index, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible
|
||||
{
|
||||
GL.gl->BindBuffer(GLconst.ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.gl.BindBuffer(GLconst.ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ namespace StgSharp.Graphics
|
||||
textureId = new uint[n];
|
||||
fixed (uint* id = textureId)
|
||||
{
|
||||
GL.gl->GenTextures(n, id);
|
||||
GL.gl.GenTextures(n, id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Bind(int index)
|
||||
{
|
||||
GL.gl->BindTexture(GLconst.PROXY_TEXTURE_2D, textureId[index]);
|
||||
GL.gl.BindTexture(GLconst.PROXY_TEXTURE_2D, textureId[index]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user