mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-11 11:03:23 +08:00
Getting started content code-rework updates.
This commit is contained in:
@@ -6,6 +6,10 @@
|
||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
|
||||
void processInput(GLFWwindow *window);
|
||||
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
|
||||
const char *vertexShaderSource ="#version 330 core\n"
|
||||
"layout (location = 0) in vec3 aPos;\n"
|
||||
"layout (location = 1) in vec3 aColor;\n"
|
||||
@@ -17,11 +21,11 @@ const char *vertexShaderSource ="#version 330 core\n"
|
||||
"}\0";
|
||||
|
||||
const char *fragmentShaderSource = "#version 330 core\n"
|
||||
"out vec4 fragColor;\n"
|
||||
"out vec4 FragColor;\n"
|
||||
"in vec3 ourColor;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" fragColor = vec4(ourColor, 1.0f);\n"
|
||||
" FragColor = vec4(ourColor, 1.0f);\n"
|
||||
"}\n\0";
|
||||
|
||||
int main()
|
||||
@@ -36,14 +40,14 @@ int main()
|
||||
|
||||
// glfw window creation
|
||||
// --------------------
|
||||
GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL);
|
||||
glfwMakeContextCurrent(window);
|
||||
GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL);
|
||||
if (window == NULL)
|
||||
{
|
||||
std::cout << "Failed to create GLFW window" << std::endl;
|
||||
glfwTerminate();
|
||||
return -1;
|
||||
}
|
||||
glfwMakeContextCurrent(window);
|
||||
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
|
||||
|
||||
// glad: load all OpenGL function pointers
|
||||
@@ -54,7 +58,6 @@ int main()
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// build and compile our shader program
|
||||
// ------------------------------------
|
||||
// vertex shader
|
||||
|
||||
Reference in New Issue
Block a user