daily update on 20240213 by nitload youmu. 逐步弃用GLFW,正在使用wgl重写glfw底层,相关实现转移到C#实现,SSC彻底变成线性代数计算器。
This commit is contained in:
@@ -41,10 +41,10 @@ namespace StgSharp.Graphics
|
||||
/// <summary>
|
||||
/// Compile the vertex shader to be attached to this shader.
|
||||
/// </summary>
|
||||
/// <param name="shaderCode">GLSL code of vertex shader.</param>
|
||||
public unsafe void Compile(ShaderType usage, params string[] code)
|
||||
/// <param name="code">GLSL code of vertex shader.</param>
|
||||
public unsafe void Compile(params string[] code)
|
||||
{
|
||||
glHandleSet.Copy(GL.CompileShader(usage, code), handle);
|
||||
glHandleSet.Copy(GL.CompileShader(type, code), handle);
|
||||
}
|
||||
|
||||
//TODO:写链接着色器的文档注释
|
||||
@@ -59,6 +59,10 @@ namespace StgSharp.Graphics
|
||||
GL.AttachShader(target.handle, handle[index]);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"This is a {type} shader, its shader handles are {handle.ToString()}.";
|
||||
}
|
||||
}
|
||||
|
||||
public class ShaderProgram
|
||||
@@ -78,11 +82,11 @@ namespace StgSharp.Graphics
|
||||
/// <summary>
|
||||
/// Link the shader to current context.
|
||||
/// </summary>
|
||||
public void Link()
|
||||
public unsafe void Link()
|
||||
{
|
||||
if (InternalIO.InternalLinkShaderProgram(handle.Value) == 0)
|
||||
if (InternalIO.InternalLinkShaderProgram(GL.Context, handle.Value) == 0)
|
||||
{
|
||||
IntPtr logPtr = InternalIO.InternalReadLog();
|
||||
IntPtr logPtr = InternalIO.InternalReadSSCLog();
|
||||
try
|
||||
{
|
||||
byte[] logByte = new byte[512];
|
||||
@@ -143,6 +147,5 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
GL.UseProgram(handle);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user