daily update on 20240209 by nitload youmu

This commit is contained in:
Nitload
2024-02-09 23:31:33 +08:00
parent 6fe6b3b3cf
commit 8391569482
159 changed files with 948 additions and 2431 deletions
+18 -15
View File
@@ -19,17 +19,17 @@ namespace StgSharp
ElementBuffer ebo;
Uniform<int> ourTexture;
Uniform<int> ourTexture2;
Shader shader;
ShaderProgram shader;
Texture texture;
VertexArray vao;
VertexBuffer vbo;
public static unsafe void ProcessInput(IntPtr windowPtr)
{
if (InternalIO.glfw.GetKey(windowPtr, (int)Operation.Key.ESCAPE)
if (InternalIO.glfwGetKey(windowPtr, (int)Operation.Key.ESCAPE)
== KeyStatus.PRESS)
{
InternalIO.glfw.SetWindowShouldClose(windowPtr, 1);
InternalIO.glfwSetWindowShouldClose(windowPtr, 1);
}
}
@@ -41,7 +41,7 @@ namespace StgSharp
ebo.Dispose();
/**/
InternalIO.glfw.Terminate();
InternalIO.glfwTerminate();
}
public unsafe void FormSizeCallback(IntPtr window, uint width, uint height)
@@ -69,12 +69,15 @@ namespace StgSharp
this.LoadGLapi(null);
shader = CreateShader(ShaderType.Program, 1);
shader = CreateShaderProgram();
var vertex = CreateShader(ShaderType.Vertex, 1);
var fragment = CreateShader(ShaderType.Fragment, 1);
vertex.Compile(File.ReadAllText("Shader\\vertex.vert"));
fragment.Compile(File.ReadAllText("Shader\\fragment.frag"));
shader.Link(0);
vertex.Compile(ShaderType.Vertex, File.ReadAllText("Shader\\vertex.vert"));
vertex.AttachTo(0, shader);
fragment.Compile(ShaderType.Fragment, File.ReadAllText("Shader\\fragment.frag"));
fragment.AttachTo(0, shader);
shader.Link();
Triangle tri = new Triangle(
-0.5f, -0.3f, 0.0f,
@@ -115,13 +118,13 @@ namespace StgSharp
ebo.SetValue(0, rec.Indices, BufferUsage.STATIC_DRAW);
vbo.SetValue(0, rec.VertexBuffer, BufferUsage.STATIC_DRAW);
gl.SetVertexAttribute(0, 3, typeof(float), false, 4 * sizeof(float), 0);
gl.SetVertexAttribute(0, 3, TypeCode.Single, false, 4 * sizeof(float), 0);
vbo.SetValueArray(1, texCoord, BufferUsage.STATIC_DRAW);
gl.SetVertexAttribute(2, 2, typeof(float), false, 2 * sizeof(float), 0);
gl.SetVertexAttribute(2, 2, TypeCode.Single, false, 2 * sizeof(float), 0);
/**/
gl.BindBuffer(BufferType.ARRAY_BUFFER, 0);
gl.BindBuffer(BufferType.ARRAY_BUFFER, glHandle.Zero);
vao.BindNull();
/**/
@@ -168,7 +171,7 @@ namespace StgSharp
texture.Bind2D(1);
/**/
float time = (float)InternalIO.glfw.GetTime();
float time = (float)InternalIO.glfwGetTime();
gl.SetValue(color,
0.5f + MathF.Sin(time),
0.5f + MathF.Sin(time/* + 0.667f * 3.14f/**/),
@@ -177,12 +180,12 @@ namespace StgSharp
vao.Bind(0);
gl.DrawElements(GepmetryType.TRIANGLES, 6, typeof(uint), IntPtr.Zero);
gl.DrawElements(GepmetryType.TRIANGLES, 6, TypeCode.UInt32, IntPtr.Zero);
vao.BindNull();
InternalIO.glfw.SwapBuffers(windowID);
InternalIO.glfw.PollEvents();
InternalIO.glfwSwapBuffers(windowID);
InternalIO.glfwPollEvents();
}
}