daily update on 20240203 by nitloadd youmu. New glhandle setup.

This commit is contained in:
Nitload
2024-02-03 23:20:50 +08:00
parent 8148c10acd
commit 5d778e0f2f
258 changed files with 10025 additions and 1220 deletions
@@ -9,47 +9,37 @@ using System.Threading.Tasks;
namespace StgSharp.Graphics
{
public partial class Form
{
protected Texture CreateTexture(uint n)
{
return new Texture(n, this.GL);
}
}
public unsafe class Texture
{
internal uint[] textureId;
internal Image[] sourceList;
internal static bool[] unitActivated = new bool[16];
internal glHandle _textureHandle;
internal Image[] sourceList;
private IglFunc GL;
internal void ChangeEnvironment(IglFunc gl)
{
GL = gl;
}
internal Texture(uint n, IglFunc gl)
{
textureId = new uint[n];
_textureHandle = new glHandle((int)n);
sourceList = new Image[n];
GL = gl;
fixed (uint* id = textureId)
{
GL.GenTextures(n, id);
}
GL.GenTextures(n, _textureHandle);
}
public void Activate(TextureUnit unit)
{
GL.ActiveTexture((uint)unit);
}
public void Bind2D(int index)
{
GL.BindTexture(GLconst.TEXTURE_2D, textureId[index]);
GL.BindTexture(GLconst.TEXTURE_2D, _textureHandle[index]);
}
/// <summary>
///
/// </summary>
/// <param name="name"></param>
/// <param name="index"></param>
/// <param name="loader"></param>
/// <param name="name"> </param>
/// <param name="index"> </param>
/// <param name="loader"> </param>
public unsafe void LoadTexture(int index, string name, ImageLoader loader)
{
sourceList[index] = new Image();
@@ -87,6 +77,11 @@ namespace StgSharp.Graphics
}
}
internal void ChangeEnvironment(IglFunc gl)
{
GL = gl;
}
#region texture set
public void Set2dFilterProperty(
@@ -103,13 +98,17 @@ namespace StgSharp.Graphics
GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_T, (int)onVertical);
}
#endregion
public void Activate(TextureUnit unit)
{
GL.ActiveTexture((uint)unit);
}
#endregion texture set
}
public enum Filter
{
Nearest = GLconst.NEAREST,
Linear = GLconst.LINEAR,
Nearest_LinearMipmap = GLconst.NEAREST_MIPMAP_LINEAR,
Linear_LinearMipmap = GLconst.LINEAR_MIPMAP_LINEAR,
Nearest_NearestMipmap = GLconst.NEAREST_MIPMAP_NEAREST,
Linear_NearestMipmap = GLconst.LINEAR_MIPMAP_NEAREST,
}
public enum TextureUnit
@@ -139,15 +138,4 @@ namespace StgSharp.Graphics
ClampToEdge = GLconst.CLAMP_TO_EDGE,
ClampToBorder = GLconst.CLAMP_TO_BORDER,
}
public enum Filter
{
Nearest = GLconst.NEAREST,
Linear = GLconst.LINEAR,
Nearest_LinearMipmap = GLconst.NEAREST_MIPMAP_LINEAR,
Linear_LinearMipmap = GLconst.LINEAR_MIPMAP_LINEAR,
Nearest_NearestMipmap = GLconst.NEAREST_MIPMAP_NEAREST,
Linear_NearestMipmap = GLconst.LINEAR_MIPMAP_NEAREST,
}
}