code cleanup
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "ElementBufferObject.h"
|
||||
#include "Shader.h"
|
||||
#include "Shape.h"
|
||||
#include "Texture.h"
|
||||
#include "VertexArrayObject.h"
|
||||
#include "VertexBufferObject.h"
|
||||
|
58
src/main.cpp
58
src/main.cpp
@@ -1,12 +1,5 @@
|
||||
/*
|
||||
* This template contains code for creating an empty
|
||||
* window in OpenGL.
|
||||
*/
|
||||
// This project is just a playground for shader programming.
|
||||
|
||||
#include "classes/ElementBufferObject.h"
|
||||
#include "classes/Shape.h"
|
||||
#include "classes/VertexArrayObject.h"
|
||||
#include "classes/VertexBufferObject.h"
|
||||
#include "glad/glad.h"
|
||||
#include "GLFW/glfw3.h"
|
||||
#include "classes/Classes.h"
|
||||
@@ -31,42 +24,6 @@ unsigned int indices[] = {
|
||||
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) {
|
||||
// Initialisation and configuration.
|
||||
glfwInit();
|
||||
@@ -91,10 +48,10 @@ int main(void) {
|
||||
}
|
||||
|
||||
// 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 shape2(vert2, sizeof(vert2), indi, sizeof(indi));
|
||||
// Shape.
|
||||
Shape shape(vertices, sizeof(vertices), indices, sizeof(indices));
|
||||
|
||||
// while loop goes here.
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
@@ -104,16 +61,13 @@ int main(void) {
|
||||
|
||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
||||
|
||||
shape1.Render(shader);
|
||||
// shape2.Render(shader);
|
||||
shape.Render(shader);
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
shape1.Delete();
|
||||
// shape2.Delete();
|
||||
|
||||
shape.Delete();
|
||||
shader.Delete();
|
||||
glfwDestroyWindow(window);
|
||||
|
||||
|
@@ -3,5 +3,9 @@
|
||||
out vec4 FragColour;
|
||||
|
||||
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user