pull/2/head
E. Almqvist 2 years ago
parent 1853a5cfcb
commit 8f560810fe
  1. BIN
      Hohmann
  2. 6
      shaders/vert.shader
  3. 10
      src/main.cpp
  4. 2
      src/shader_loader.cpp

Binary file not shown.

@ -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);
}

@ -5,7 +5,7 @@
#define WINDOW_WIDTH 640 #define WINDOW_WIDTH 640
#define WINDOW_HEIGHT 480 #define WINDOW_HEIGHT 480
float verts[] = { static float verts[] = {
-0.5f, -0.5f, 0.0f, -0.5f, -0.5f, 0.0f,
0.5f, -0.5f, 0.0f, 0.5f, -0.5f, 0.0f,
0.0f, 0.5f, 0.0f 0.0f, 0.5f, 0.0f
@ -30,6 +30,8 @@ void renderCallback(GLFWwindow *win) {
glGenBuffers(1, &VBO); glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, 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() { int main() {
@ -40,7 +42,7 @@ int main() {
GLFWwindow* win = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Hohmann", NULL, NULL); GLFWwindow* win = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Hohmann", NULL, NULL);
if (win == NULL) { if (win == NULL) {
printf("Failed to create a window."); printf("Failed to create a window.\n");
glfwTerminate(); glfwTerminate();
return 1; return 1;
} }
@ -48,7 +50,7 @@ int main() {
glfwMakeContextCurrent(win); glfwMakeContextCurrent(win);
if ( !gladLoadGLLoader((GLADloadproc)glfwGetProcAddress) ) { if ( !gladLoadGLLoader((GLADloadproc)glfwGetProcAddress) ) {
printf("Failed to init GLAD."); printf("Failed to init GLAD.\n");
return 1; return 1;
} }
@ -60,6 +62,8 @@ int main() {
processInput(win); processInput(win);
// rendering // rendering
verts[1] += 0.0001f;
printf("f=%f\n", verts[1]);
renderCallback(win); renderCallback(win);
// glfw // glfw

@ -0,0 +1,2 @@
#include <fstream>
Loading…
Cancel
Save