Let's just call it debugging even tho it has notihing to do with it
This commit is contained in:
56
src/lorenz.c
56
src/lorenz.c
@@ -2,6 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <linmath.h>
|
||||
#include "Renderer.h"
|
||||
@@ -33,20 +34,33 @@ int main(int argc, char *argv[]) {
|
||||
unsigned int VAO, VBO;
|
||||
glGenVertexArrays(1, &VAO);
|
||||
glGenBuffers(1, &VBO);
|
||||
//unsigned int EBO;
|
||||
//glGenBuffers(1, &EBO);
|
||||
|
||||
glBindVertexArray(VAO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vec3), NULL, GL_DYNAMIC_DRAW);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0 );
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
vec3 vertices[3000];
|
||||
|
||||
int i=0;
|
||||
float dx, dy, dz;
|
||||
float dt=0.01;
|
||||
vertices[0][0]=1.0;
|
||||
vertices[0][1]=1.0;
|
||||
vertices[0][2]=1.0;
|
||||
float dx, dy, dz, dt=0.001;
|
||||
vertices[0][0]=0.01;
|
||||
vertices[0][1]=0.01;
|
||||
vertices[0][2]=0.01;
|
||||
|
||||
|
||||
for(i=0; i<3000; NULL) {
|
||||
mat4x4 proj;
|
||||
mat4x4_ortho(proj, 0.0, 400.0, 0.0, 400.0, 0.1, 100.0);
|
||||
|
||||
while(!glfwWindowShouldClose(window)) {
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glUseProgram(shader1);
|
||||
|
||||
//glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, *proj);
|
||||
|
||||
if(i<3000) {
|
||||
float x, y, z;
|
||||
x = vertices[i][0];
|
||||
y = vertices[i][1];
|
||||
@@ -63,29 +77,9 @@ int main(int argc, char *argv[]) {
|
||||
vertices[i][1] = y+dy;
|
||||
vertices[i][2] = z+dz;
|
||||
|
||||
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vec3), vertices[i]);
|
||||
}
|
||||
|
||||
glBindVertexArray(VAO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, 3000 * sizeof(vec3), vertices, GL_DYNAMIC_DRAW);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0 );
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
mat4x4 proj;
|
||||
mat4x4_identity(proj);
|
||||
mat4x4_ortho(proj, 0.0, 500.0, 0.0, 500.0, 0.1, 100.0);
|
||||
|
||||
while(!glfwWindowShouldClose(window)) {
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glUseProgram(shader1);
|
||||
glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, *proj);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VAO);
|
||||
glDrawArrays(GL_POINTS, 0, i);
|
||||
|
||||
glDrawArrays(GL_POINTS, 0, 1);
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
|
||||
Reference in New Issue
Block a user