daily update on 20230525 by nitload youmu, ses00001 not solved
This commit is contained in:
@@ -9,9 +9,32 @@
|
||||
#include "internal.h"
|
||||
|
||||
extern float* triangleVertexes;
|
||||
double previousTime = 0;
|
||||
double targetFPS = 60.0;
|
||||
|
||||
const char* vertexShaderSource =
|
||||
"#version 460 core\n"
|
||||
"layout (location = 0) in vec3 aPos;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
"gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
|
||||
"}\n\0";
|
||||
|
||||
const char* fragmentShaderSource =
|
||||
"#version 460 core\n"
|
||||
"out vec4 FragColor;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
"FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n"
|
||||
"}\n\0"
|
||||
;
|
||||
|
||||
float triangle[] =
|
||||
{
|
||||
0,0.5f,0,
|
||||
-0.5f,-0.5f,0,
|
||||
0.5f,-0.5f,0,
|
||||
};
|
||||
|
||||
int version[4] = { 0,0,0,0 };
|
||||
STGSHARPGRAPHICS_API int* versionInfo = &version;
|
||||
@@ -32,31 +55,7 @@ STGSHARPGRAPHICS_API IOpackage initPackage(void)
|
||||
|
||||
STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
|
||||
{
|
||||
printf("%f,%f,%f,%f,", info.backgroundColor[0], info.backgroundColor[1], info.backgroundColor[2], info.backgroundColor[3]);
|
||||
|
||||
const char* vertexShaderSource =
|
||||
"#version 460 core\n"
|
||||
"layout (location = 0) in vec3 aPos;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
"gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
const char* fragmentShaderSource =
|
||||
"#version 460 core\n"
|
||||
"out vec4 FragColor;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
"FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n"
|
||||
"}\n"
|
||||
;
|
||||
|
||||
float triangle[] =
|
||||
{
|
||||
0,0.5f,0,
|
||||
-0.5f,-0.5f,0,
|
||||
0.5f,-0.5f,0,
|
||||
};
|
||||
|
||||
|
||||
|
||||
glfwInit();
|
||||
@@ -83,6 +82,8 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
|
||||
return -1;
|
||||
}
|
||||
|
||||
glfwSwapInterval(0);
|
||||
|
||||
//编译顶点着色器
|
||||
|
||||
unsigned int vertexShader;
|
||||
@@ -135,23 +136,33 @@ STGSHARPGRAPHICS_API int initWindow(basicWindowInfo info)
|
||||
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
if (1)
|
||||
{
|
||||
|
||||
}
|
||||
// input
|
||||
// -----
|
||||
|
||||
// render
|
||||
// ------
|
||||
|
||||
/**/
|
||||
glClearColor(
|
||||
info.backgroundColor[0],
|
||||
info.backgroundColor[1],
|
||||
info.backgroundColor[2],
|
||||
info.backgroundColor[3]
|
||||
info.backgroundColor.x,
|
||||
info.backgroundColor.y,
|
||||
info.backgroundColor.Z,
|
||||
info.backgroundColor.w
|
||||
);
|
||||
/**/
|
||||
//glClearColor(0.1f,0.3f,0.5f,1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// draw our first triangle
|
||||
/**/
|
||||
glUseProgram(shaderProgram);
|
||||
glBindVertexArray(VAO); // seeing as we only have a single VAO there's no need to bind it every time, but we'll do so to keep things a bit more organized
|
||||
glBindVertexArray(VAO);
|
||||
// seeing as we only have a single VAO there's no need to bind it every time,
|
||||
// but we'll do so to keep things a bit more organized
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
//glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
||||
// glBindVertexArray(0); // no need to unbind it every time
|
||||
|
||||
Reference in New Issue
Block a user