mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-12 03:23:22 +08:00
Getting started content code-rework updates.
This commit is contained in:
@@ -8,6 +8,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;
|
||||
|
||||
int main()
|
||||
{
|
||||
// glfw: initialize and configure
|
||||
@@ -20,14 +24,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
|
||||
@@ -38,7 +42,6 @@ int main()
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// build and compile our shader program
|
||||
// ------------------------------------
|
||||
Shader ourShader("3.3.shader.vs", "3.3.shader.fs"); // you can name your shader files however you like
|
||||
@@ -50,7 +53,6 @@ int main()
|
||||
0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom right
|
||||
-0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, // bottom left
|
||||
0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 1.0f // top
|
||||
|
||||
};
|
||||
|
||||
unsigned int VBO, VAO;
|
||||
|
||||
Reference in New Issue
Block a user