From 9d37a3007fd5369a652e98f342794190ac6dd237 Mon Sep 17 00:00:00 2001 From: Elipzer Date: Tue, 11 Sep 2018 12:10:11 -0400 Subject: [PATCH] Add Relative Shader Directory Preprocessor to .sln This allows computers that do not have my personal directory setup to use visual studio macros to get to the shader dir. --- OpenGLEngine/MyBasicShaderProgram.cpp | 4 ++-- OpenGLEngine/MySimpleShaderProgram.cpp | 4 ++-- OpenGLEngine/OpenGLEngine.vcxproj | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenGLEngine/MyBasicShaderProgram.cpp b/OpenGLEngine/MyBasicShaderProgram.cpp index 1454dcd..4b59e5f 100644 --- a/OpenGLEngine/MyBasicShaderProgram.cpp +++ b/OpenGLEngine/MyBasicShaderProgram.cpp @@ -4,8 +4,8 @@ MyBasicShaderProgram::MyBasicShaderProgram() // TEMP Hardcode in the path. (Should Use Relative Path to General Shader Dir) - : m_vertex_shader(Util::load_file("D:/Development/C++/OpenGLEngine/OpenGLEngine/MyBasicVS.glsl"), VERTEX_SHADER), - m_fragment_shader(Util::load_file("D:/Development/C++/OpenGLEngine/OpenGLEngine/MyBasicFS.glsl"), FRAGMENT_SHADER) + : m_vertex_shader(Util::load_file(SHADER_PATH "MyBasicVS.glsl"), VERTEX_SHADER), + m_fragment_shader(Util::load_file(SHADER_PATH "MyBasicFS.glsl"), FRAGMENT_SHADER) { attach_shader(m_vertex_shader); attach_shader(m_fragment_shader); diff --git a/OpenGLEngine/MySimpleShaderProgram.cpp b/OpenGLEngine/MySimpleShaderProgram.cpp index db7f976..7ed61c4 100644 --- a/OpenGLEngine/MySimpleShaderProgram.cpp +++ b/OpenGLEngine/MySimpleShaderProgram.cpp @@ -4,8 +4,8 @@ MySimpleShaderProgram::MySimpleShaderProgram() // TEMP Hardcode in the path. (Should Use Relative Path to General Shader Dir) - : m_vertex_shader(Util::load_file("D:/Development/C++/OpenGLEngine/OpenGLEngine/MySimpleVS.glsl"), VERTEX_SHADER), - m_fragment_shader(Util::load_file("D:/Development/C++/OpenGLEngine/OpenGLEngine/MySimpleFS.glsl"), FRAGMENT_SHADER) + : m_vertex_shader(Util::load_file(SHADER_PATH "MySimpleVS.glsl"), VERTEX_SHADER), + m_fragment_shader(Util::load_file(SHADER_PATH "MySimpleFS.glsl"), FRAGMENT_SHADER) { attach_shader(m_vertex_shader); attach_shader(m_fragment_shader); diff --git a/OpenGLEngine/OpenGLEngine.vcxproj b/OpenGLEngine/OpenGLEngine.vcxproj index d07bbd5..accd101 100644 --- a/OpenGLEngine/OpenGLEngine.vcxproj +++ b/OpenGLEngine/OpenGLEngine.vcxproj @@ -91,6 +91,7 @@ true $(ProjectDir)..\include;%(AdditionalIncludeDirectories) NotUsing + SHADER_PATH=R"($(ProjectDir))";%(PreprocessorDefinitions) @@ -130,6 +131,7 @@ true $(ProjectDir)..\include;%(AdditionalIncludeDirectories) NotUsing + SHADER_PATH=R"($(ProjectDir))";%(PreprocessorDefinitions) true