Support for out-of-source builds.

Uses environment variable to tell the program where to find resource
files.
Sharder sources are still search for in the current workind directory.
This commit is contained in:
Marin Nilsson
2015-07-30 21:48:41 +02:00
parent eac76c9a50
commit a8a8d11f22
28 changed files with 189 additions and 118 deletions

View File

@@ -19,6 +19,7 @@
// Other Libs
#include <SOIL.h>
#include <learnopengl/filesystem.h>
// Properties
GLuint screenWidth = 800, screenHeight = 600;
@@ -28,7 +29,7 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
void mouse_callback(GLFWwindow* window, double xpos, double ypos);
void Do_Movement();
GLuint loadTexture(GLchar* path);
GLuint loadTexture(GLchar const * path);
// Camera
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
@@ -160,8 +161,8 @@ int main()
glBindVertexArray(0);
// Load textures
GLuint cubeTexture = loadTexture("../../../resources/textures/marble.jpg");
GLuint floorTexture = loadTexture("../../../resources/textures/metal.png");
GLuint cubeTexture = loadTexture(FileSystem::getPath("resources/textures/marble.jpg").c_str());
GLuint floorTexture = loadTexture(FileSystem::getPath("resources/textures/metal.png").c_str());
#pragma endregion
// Game loop
@@ -260,7 +261,7 @@ void DrawScene()
// This function loads a texture from file. Note: texture loading functions like these are usually
// managed by a 'Resource Manager' that manages all resources (like textures, models, audio).
// For learning purposes we'll just define it as a utility function.
GLuint loadTexture(GLchar* path)
GLuint loadTexture(GLchar const * path)
{
//Generate texture ID and load texture data
GLuint textureID;