daily update on 20240209 by nitload youmu
This commit is contained in:
@@ -11,19 +11,18 @@ namespace StgSharp.Graphics
|
||||
|
||||
/// <summary>
|
||||
/// A collecion of handle to Element Buffer Object in OpenGL.
|
||||
/// Each <see cref="uint"/> value indexed from instance of this class this
|
||||
/// Each <see langword="int"/> value indexed from instance of this class this
|
||||
/// is the only handle to one Element Buffer Object.
|
||||
/// </summary>
|
||||
public unsafe class ElementBuffer : IBufferObject
|
||||
{
|
||||
internal ElementBuffer(uint n, IglFunc gl)
|
||||
internal ElementBuffer(int n, IglFunc gl)
|
||||
{
|
||||
_bufferHandle = new glHandle((int)n);
|
||||
GL = gl;
|
||||
GL.GenBuffers(n, _bufferHandle);
|
||||
_bufferHandle = GL.GenBuffers(n);
|
||||
}
|
||||
|
||||
public uint this[int n]
|
||||
public glHandle this[int n]
|
||||
{
|
||||
get { return _bufferHandle[n]; }
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace StgSharp.Graphics
|
||||
/// </summary>
|
||||
public abstract class IBufferObject : IDisposable
|
||||
{
|
||||
protected glHandle _bufferHandle;
|
||||
protected glHandleSet _bufferHandle;
|
||||
protected IglFunc GL;
|
||||
|
||||
/// <summary>
|
||||
@@ -19,7 +19,7 @@ namespace StgSharp.Graphics
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public uint this[int index]
|
||||
public glHandle this[int index]
|
||||
{
|
||||
get { return _bufferHandle[index]; }
|
||||
}
|
||||
|
||||
@@ -8,11 +8,10 @@ namespace StgSharp.Graphics
|
||||
|
||||
public unsafe class VertexArray : IBufferObject
|
||||
{
|
||||
internal VertexArray(uint n, IglFunc gl)
|
||||
internal VertexArray(int n, IglFunc gl)
|
||||
{
|
||||
_bufferHandle = new glHandle((int)n);
|
||||
GL = gl;
|
||||
GL.GenVertexArrays(n, _bufferHandle);
|
||||
_bufferHandle = GL.GenVertexArrays(n);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -24,11 +23,11 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void BindNull()
|
||||
{
|
||||
GL.BindVertexArray(0);
|
||||
GL.BindVertexArray(glHandle.Alloc(0));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetVertexAttribute(uint index, int vertexLength, Type dataType, bool isNomalized, uint stride, int pointer)
|
||||
public void SetVertexAttribute(uint index, int vertexLength, TypeCode dataType, bool isNomalized, uint stride, int pointer)
|
||||
{
|
||||
GL.SetVertexAttribute(
|
||||
index, vertexLength, dataType,
|
||||
|
||||
@@ -12,16 +12,15 @@ namespace StgSharp.Graphics
|
||||
|
||||
public unsafe class VertexBuffer : IBufferObject
|
||||
{
|
||||
internal VertexBuffer(uint n, IglFunc glFunc)
|
||||
internal VertexBuffer(int n, IglFunc glFunc)
|
||||
{
|
||||
_bufferHandle = new glHandle((int)n);
|
||||
GL = glFunc;
|
||||
GL.GenBuffers(n, _bufferHandle);
|
||||
_bufferHandle = GL.GenBuffers(n);
|
||||
}
|
||||
|
||||
public sealed override void Bind(int index)
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, (uint)index);
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferHandle[index]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -57,7 +56,7 @@ namespace StgSharp.Graphics
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Unbind()
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, 0);
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, glHandle.Zero);
|
||||
}
|
||||
internal void ChangeEnvironment(IglFunc gl)
|
||||
{
|
||||
|
||||
@@ -17,12 +17,11 @@ namespace StgSharp.Graphics
|
||||
internal Image[] sourceList;
|
||||
private IglFunc GL;
|
||||
|
||||
internal Texture(uint n, IglFunc gl)
|
||||
internal Texture(int n, IglFunc gl)
|
||||
{
|
||||
_textureHandle = new glHandleSet((int)n);
|
||||
sourceList = new Image[n];
|
||||
GL = gl;
|
||||
GL.GenTextures(n, _textureHandle);
|
||||
_textureHandle = GL.GenTextures(n);
|
||||
}
|
||||
|
||||
public void Activate(TextureUnit unit)
|
||||
@@ -65,10 +64,10 @@ namespace StgSharp.Graphics
|
||||
channel = 0;
|
||||
break;
|
||||
}
|
||||
GL.TextureImage2d(
|
||||
GL.TextureImage2d<byte>(
|
||||
GLconst.TEXTURE_2D, 0, channel,
|
||||
(uint)sourceList[index].Width, (uint)sourceList[index].Height,
|
||||
channel, GLconst.UNSIGNED_BYTE, (byte*)sourceList[index].info.pixelPtr
|
||||
channel, GLconst.UNSIGNED_BYTE, sourceList[index].pixelArray
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user