diff --git a/data/shaders/basicshader.frag b/data/shaders/basicshader.frag index 7ad92534477e8688f6a6cbdc34e486ec298f57dc..75c6387f80402cb216c71a4bc7dcc16f7ba106cb 100644 --- a/data/shaders/basicshader.frag +++ b/data/shaders/basicshader.frag @@ -1,5 +1,5 @@ #version 330 core -layout(location = 3) out vec4 FragColor; +layout(location = 0) out vec4 FragColor; void main() { FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f); diff --git a/src/gfx/CMakeLists.txt b/src/gfx/CMakeLists.txt index c5db99f93331d6ad271ae56ec5c887647a747981..3579816ac11568bd8d6c935d21e95115e03efc40 100644 --- a/src/gfx/CMakeLists.txt +++ b/src/gfx/CMakeLists.txt @@ -3,10 +3,10 @@ set(THIS_TARGET_NAME gfx) add_library(${THIS_TARGET_NAME} #./include/gfx/file.hpp ./include/gfx/shader.h + ./src/shader.cpp ./include/gfx/render.hpp ./src/render.cpp - ./src/shader.cpp # ./include/osi/opengl.hpp # ./include/osi/gui.hpp diff --git a/src/gfx/include/gfx/render.hpp b/src/gfx/include/gfx/render.hpp index 311b8ccee3b8206f4b9ec52179e673b97a8c9ef4..d87a7a49c47e66c1653bf8370ebb2a320f3dbe1a 100644 --- a/src/gfx/include/gfx/render.hpp +++ b/src/gfx/include/gfx/render.hpp @@ -1,12 +1,13 @@ -#ifndef TEMP_FILE_INCLUDED -#define TEMP_FILE_INCLUDED +#ifndef RENDER_INCLUDED +#define RENDER_INCLUDED #include <studio/simulator.hpp> #include <osi/opengl.hpp> #include <osi/gui.hpp> -#include <gfx/render.hpp> -#include <gfx/shader.h> + #include <glad/glad.h> +#include <gfx/shader.h> +#include <gfx/render.hpp> #include <iostream> Shader create_shader_program(); diff --git a/src/gfx/include/gfx/shader.h b/src/gfx/include/gfx/shader.h index a1ce86d47d4f0c6729f8910d66253d65d3524617..998663e7714995991262c916d90c4025cc786ea0 100644 --- a/src/gfx/include/gfx/shader.h +++ b/src/gfx/include/gfx/shader.h @@ -1,11 +1,9 @@ -#ifndef SHADER -#define SHADER +#ifndef SHADER_INCLUDED +#define SHADER_INCLUDED +#include <glad/glad.h> #include <string> -#include <fstream> -#include <sstream> #include <iostream> -#include <glad/glad.h> class Shader { diff --git a/src/gfx/src/render.cpp b/src/gfx/src/render.cpp index 1aa99dacface281cff1d130c4ee39166b52e62c3..50bf7d7168e02130fe580cc0889f38f980815afc 100644 --- a/src/gfx/src/render.cpp +++ b/src/gfx/src/render.cpp @@ -1,9 +1,10 @@ #include <studio/simulator.hpp> #include <osi/opengl.hpp> #include <osi/gui.hpp> -#include <gfx/render.hpp> -#include <gfx/shader.h> + #include <glad/glad.h> +#include <gfx/render.hpp> // Order important for compile +#include <gfx/shader.h> #include <iostream> Shader create_shader_program() @@ -20,7 +21,7 @@ bool create_buffer(unsigned int &VAO, unsigned int &VBO, unsigned int &EBO) /** VERTEX INPUT **/ //TRIANGLE - float vertices_triangle[] = { + float vertices_traingle[] = { -0.5f, -0.5f, 0.0f, // left 0.5f, -0.5f, 0.0f, // right 0.0f, 0.5f, 0.0f // top diff --git a/src/gfx/src/shader.cpp b/src/gfx/src/shader.cpp index f1e352a38a562932fde7aba7488b54ca67452d72..5a27fe3ca5c3f2ebc506ac992bf80bb315dd5bff 100644 --- a/src/gfx/src/shader.cpp +++ b/src/gfx/src/shader.cpp @@ -1,5 +1,12 @@ #include <gfx/shader.h> +#include <glad/glad.h> +#include <string> +#include <fstream> +#include <sstream> +#include <iostream> + + //constructor Shader::Shader(const char* vertexPath, const char* fragmentPath) { @@ -34,11 +41,8 @@ Shader::Shader(const char* vertexPath, const char* fragmentPath) const char* vShaderCode = vertexCode.c_str(); const char* fShaderCode = fragmentCode.c_str(); - // 2. compile shaders unsigned int vertex, fragment; - int success; - char infoLog[512]; // vertex Shader vertex = glCreateShader(GL_VERTEX_SHADER); diff --git a/src/studio/include/studio/simulator.hpp b/src/studio/include/studio/simulator.hpp index f4c733a6652628dd5abf3c1632758ec5750dce4f..9b98c9c8f8fd9770951685d46ece9e37573d320b 100644 --- a/src/studio/include/studio/simulator.hpp +++ b/src/studio/include/studio/simulator.hpp @@ -6,9 +6,10 @@ #include <osi/opengl.hpp> #include <osi/gui.hpp> -#include <gfx/render.hpp> -#include <gfx/shader.h> + #include <glad/glad.h> +#include <gfx/shader.h> +#include <gfx/render.hpp> #include <iostream> namespace studio { diff --git a/src/studio/src/simulator.cpp b/src/studio/src/simulator.cpp index 1ff89eb0ccf2eb6505023dfcca61cdc584d072d0..7ca58ebf645f223aac34eb2d32865744d43ccbeb 100644 --- a/src/studio/src/simulator.cpp +++ b/src/studio/src/simulator.cpp @@ -1,9 +1,10 @@ #include <studio/simulator.hpp> #include <osi/opengl.hpp> #include <osi/gui.hpp> -#include <gfx/render.hpp> -#include <gfx/shader.h> + #include <glad/glad.h> +#include <gfx/shader.h> +#include <gfx/render.hpp> #include <iostream> namespace studio {