diff --git a/Hohmann b/Hohmann index f2f99d1..8515bfd 100755 Binary files a/Hohmann and b/Hohmann differ diff --git a/shaders/vert.shader b/shaders/vert.shader new file mode 100644 index 0000000..ea9cef1 --- /dev/null +++ b/shaders/vert.shader @@ -0,0 +1,6 @@ +#version 330 core +layout (location = 0) in vec3 aPos; + +void main() { + gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0); +} diff --git a/src/main.cpp b/src/main.cpp index 98cd761..921985c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,7 +5,7 @@ #define WINDOW_WIDTH 640 #define WINDOW_HEIGHT 480 -float verts[] = { +static float verts[] = { -0.5f, -0.5f, 0.0f, 0.5f, -0.5f, 0.0f, 0.0f, 0.5f, 0.0f @@ -30,6 +30,8 @@ void renderCallback(GLFWwindow *win) { glGenBuffers(1, &VBO); glBindBuffer(GL_ARRAY_BUFFER, VBO); + glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_DYNAMIC_DRAW); // for moving stuff + //glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STATIC_DRAW); } int main() { @@ -40,7 +42,7 @@ int main() { GLFWwindow* win = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Hohmann", NULL, NULL); if (win == NULL) { - printf("Failed to create a window."); + printf("Failed to create a window.\n"); glfwTerminate(); return 1; } @@ -48,7 +50,7 @@ int main() { glfwMakeContextCurrent(win); if ( !gladLoadGLLoader((GLADloadproc)glfwGetProcAddress) ) { - printf("Failed to init GLAD."); + printf("Failed to init GLAD.\n"); return 1; } @@ -60,6 +62,8 @@ int main() { processInput(win); // rendering + verts[1] += 0.0001f; + printf("f=%f\n", verts[1]); renderCallback(win); // glfw diff --git a/src/shader_loader.cpp b/src/shader_loader.cpp new file mode 100644 index 0000000..51da84c --- /dev/null +++ b/src/shader_loader.cpp @@ -0,0 +1,2 @@ +#include +