Generated opengl function binding added. All opengl core profile function is now available but not in C# flavour.

This commit is contained in:
Youmu Liu
2025-12-30 19:16:05 +08:00
parent b7c32bdf6d
commit 6484307b8a
40 changed files with 14965 additions and 3893 deletions
+6 -8
View File
@@ -39,7 +39,9 @@ namespace StgSharp
private static string testExpPath = @"D:\Programmer\stepcode\data\ap203\ap203.exp";
internal static unsafe void Main(string[] args)
internal static unsafe void Main(
string[] args
)
{
try
{
@@ -48,12 +50,8 @@ namespace StgSharp
.UseModule<GraphicModule>()
.InitializeModule();
// TestRender();
// TestHlsf();
// HlsfStressTest.Run();
/**/
TestRender();
/*
HybridLayerSegregatedFitAllocator hlsf;
unchecked {
hlsf = new((nuint)(64 * (ulong)10000 * 10000));
@@ -79,7 +77,7 @@ namespace StgSharp
Console.WriteLine($"{i}");
GC.Collect();
}
/**/
/*
MatrixCompute.Mul(n, m, p);
for (int i = 0; i < 20; i++)
{
+33 -17
View File
@@ -1,4 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Partical"
// Project: StgSharp
@@ -75,7 +75,9 @@ namespace StgSharp
public TextureProvider ButtonTextureProvider { get; private set; }
// render a controlling item
public void ButtonMain(IEnumerable<PlainGeometryMesh> items)
public void ButtonMain(
IEnumerable<PlainGeometryMesh> items
)
{
// Console.WriteLine("Render Button Itself");
@@ -106,7 +108,7 @@ namespace StgSharp
temp++;
// GL.ClearError();
GL.Viewport(0, 0, (uint)Width, (uint)Height);
GL.Viewport(0, 0, Width, Height);
// Console.Clear();
buffer.UpdateAllParticles();
@@ -117,12 +119,13 @@ namespace StgSharp
vao.Bind(0); //GL.Assert(true);
t.Bind2D(0); //GL.Assert(false);
GL.Viewport(0, 0, (uint)Width, (uint)Height);
GL.Viewport(0, 0, Width, Height);
/**/
GL.TextureImage2d<byte>(Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width,
(uint)Height, ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null);
GL.TextureImage2d<byte>(Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel,
Width, Height, ImageChannel.WithAlphaChannel,
PixelChannelLayout.Byte, null);
/**/
// GL.Assert(false);
@@ -162,8 +165,8 @@ namespace StgSharp
// GL.ClearError();
// Console.Write($"Size set to {Height},{Width}");
// Console.WriteLine($"Image resized to {i.Height} {i.Width}");
GL.GetTextureImage(Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte,
i.PixelBuffer);
GL.GetTextureImage(Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel,
PixelChannelLayout.Byte, i.PixelBuffer);
/*
for (int num = 0; num < i.PixelBuffer.Length; num+=10000)
{
@@ -189,12 +192,19 @@ namespace StgSharp
GL.Assert(false);
}
public void RenderButton(ButtonStatus status, float statusBegin, in TextureProvider provider)
public void RenderButton(
ButtonStatus status,
float statusBegin,
in TextureProvider provider
)
{
provider.UpdateFromImage(i);
}
internal static Vec3 DefaultRotation(TimeSpanProvider provider, out float rotation)
internal static Vec3 DefaultRotation(
TimeSpanProvider provider,
out float rotation
)
{
rotation = 1.0f / 60;
float angle = (float)provider.CurrentSecond * 2;
@@ -261,7 +271,8 @@ namespace StgSharp
ebo = CreateElementBuffer(1);
vbo.Bind(0);
Rectangle rec = new Rectangle(0.05f, 0.05f, 0.05f, -0.05f, -0.05f, -0.05f, -0.05f, 0.05f);
Rectangle rec = new Rectangle(0.05f, 0.05f, 0.05f, -0.05f, -0.05f, -0.05f, -0.05f,
0.05f);
// GL.Assert(true);
vao.Bind(0);
@@ -271,7 +282,8 @@ namespace StgSharp
vbo.WriteVectorData<Vec4>(1, buffer.CoordAndRotationSpan, BufferUsage.StreamDraw);
vao.SetVertexAttribute(1, 3, TypeCode.Single, false, 4 * sizeof(float), 0);
vao.SetVertexAttribute(2, 1, TypeCode.Single, false, 4 * sizeof(float), 3 * sizeof(float));
vao.SetVertexAttribute(2, 1, TypeCode.Single, false, 4 * sizeof(float),
3 * sizeof(float));
GL.VertexAttributeDivisor(1, 1);
GL.VertexAttributeDivisor(2, 1);
@@ -310,13 +322,15 @@ namespace StgSharp
// GL.Assert(true);
t = CreateTexture(1);
t.Bind2D(0);
GL.TextureImage2d<byte>(Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width,
(uint)Height, ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null!);
GL.TextureImage2d<byte>(Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel,
Width, Height, ImageChannel.WithAlphaChannel,
PixelChannelLayout.Byte, null!);
t.Set2dWrapProperty(0, TextureWrap.Repeat, TextureWrap.Repeat);
t.Set2dFilterProperty(0, TextureFilter.Linear, TextureFilter.Linear);
// GL.Assert(true);
GL.FrameBufferTexture2d(FrameBufferTarget.All, glAttachment.Color(0), Texture2DTarget.Texture2D, t[0], 0);
GL.FrameBufferTexture2d(FrameBufferTarget.All, glAttachment.Color(0),
Texture2DTarget.Texture2D, t[0], 0);
GL.SetRenderBufferStorage(RenderBufferInternalFormat.Depth24_Stencil8, this.Size);
GL.CombineFrameBufferRenderBuffer(FrameBufferAttachment.DepthAndStencil, rbo[0]);
@@ -367,8 +381,10 @@ namespace StgSharp
// GL.Assert(true);
autoT = CreateAutoTexture(4);
autoT.DefaultTextureProperty = new TextureProperty(TextureFilter.Nearest, TextureFilter.Nearest,
TextureWrap.Repeat, TextureWrap.Repeat);
autoT.DefaultTextureProperty = new TextureProperty(TextureFilter.Nearest,
TextureFilter.Nearest,
TextureWrap.Repeat,
TextureWrap.Repeat);
f_t = CreateTexture(1);
f_t.Bind2D(0);