code cleanup

This commit is contained in:
CJSatnarine
2025-02-24 21:27:48 -05:00
parent 8b7d3f2ba7
commit 44fa48d08b
3 changed files with 13 additions and 54 deletions

View File

@@ -1,5 +1,6 @@
#include "ElementBufferObject.h" #include "ElementBufferObject.h"
#include "Shader.h" #include "Shader.h"
#include "Shape.h"
#include "Texture.h" #include "Texture.h"
#include "VertexArrayObject.h" #include "VertexArrayObject.h"
#include "VertexBufferObject.h" #include "VertexBufferObject.h"

View File

@@ -1,12 +1,5 @@
/* // This project is just a playground for shader programming.
* This template contains code for creating an empty
* window in OpenGL.
*/
#include "classes/ElementBufferObject.h"
#include "classes/Shape.h"
#include "classes/VertexArrayObject.h"
#include "classes/VertexBufferObject.h"
#include "glad/glad.h" #include "glad/glad.h"
#include "GLFW/glfw3.h" #include "GLFW/glfw3.h"
#include "classes/Classes.h" #include "classes/Classes.h"
@@ -31,42 +24,6 @@ unsigned int indices[] = {
1, 2, 3 // second Triangle 1, 2, 3 // second Triangle
}; };
float vert1[] = {
0.0f, 1.0f, 0.0f,
0.5f, -0.50f, 0.0f,
-0.5f, -0.50f, 0.0f
};
float vert2[] = {
0.0f, -1.0f, 0.0f,
0.5f, 0.50f, 0.0f,
-0.5f, 0.50f, 0.0f
};
float vert3[] = {
0.0f, 1.0f, 0.0f,
1.0f, 0.25f, 0.0f,
1.0f, -0.25f, 0.0f,
0.0f, -1.0f, 0.0f,
-1.0f, -0.25f, 0.0f,
-1.0f, 0.25f, 0.0f,
0.0f, 0.0f, 0.0f,
};
unsigned int indi[] = {
0, 1, 2
};
unsigned int indi2[] = {
0, 6, 1,
1, 6, 2,
2, 6, 3,
3, 6, 4,
4, 6, 5,
5, 6, 0
};
int main(void) { int main(void) {
// Initialisation and configuration. // Initialisation and configuration.
glfwInit(); glfwInit();
@@ -91,10 +48,10 @@ int main(void) {
} }
// Shader stuff. // Shader stuff.
Shader shader("../src/shaders/vertexShader.vert.glsl", "../src/shaders/frag_rgb_shader.frag.glsl"); Shader shader("../src/shaders/vertexShader.vert.glsl", "../src/shaders/fragmentShader.frag.glsl");
Shape shape1(vertices, sizeof(vertices), indices, sizeof(indices)); // Shape.
// Shape shape2(vert2, sizeof(vert2), indi, sizeof(indi)); Shape shape(vertices, sizeof(vertices), indices, sizeof(indices));
// while loop goes here. // while loop goes here.
while (!glfwWindowShouldClose(window)) { while (!glfwWindowShouldClose(window)) {
@@ -104,16 +61,13 @@ int main(void) {
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
shape1.Render(shader); shape.Render(shader);
// shape2.Render(shader);
glfwSwapBuffers(window); glfwSwapBuffers(window);
glfwPollEvents(); glfwPollEvents();
} }
shape1.Delete(); shape.Delete();
// shape2.Delete();
shader.Delete(); shader.Delete();
glfwDestroyWindow(window); glfwDestroyWindow(window);

View File

@@ -3,5 +3,9 @@
out vec4 FragColour; out vec4 FragColour;
void main() { void main() {
FragColour = vec4(1.0f, 0.0f, 1.0f, 1.0f); float r = 1.0;
float g = 1.0;
float b = 1.0;
FragColour = vec4(r, g, b, 1.0f);
} }