daily update on 20240209 by nitload youmu
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user