mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
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:
@@ -16,6 +16,7 @@
|
||||
|
||||
// Other Libs
|
||||
#include <SOIL.h>
|
||||
#include <learnopengl/filesystem.h>
|
||||
|
||||
// Properties
|
||||
const GLuint SCR_WIDTH = 800, SCR_HEIGHT = 600;
|
||||
@@ -25,7 +26,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));
|
||||
@@ -100,7 +101,7 @@ int main()
|
||||
glm::vec3 lightPos(0.0f, 0.0f, 0.0f);
|
||||
|
||||
// Load textures
|
||||
GLuint floorTexture = loadTexture("../../../resources/textures/wood.png");
|
||||
GLuint floorTexture = loadTexture(FileSystem::getPath("resources/textures/wood.png").c_str());
|
||||
|
||||
// Game loop
|
||||
while(!glfwWindowShouldClose(window))
|
||||
@@ -147,7 +148,7 @@ int main()
|
||||
// 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;
|
||||
|
||||
Reference in New Issue
Block a user