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:
@@ -21,6 +21,7 @@ using namespace std;
|
||||
|
||||
// Other Libs
|
||||
#include <SOIL.h>
|
||||
#include <learnopengl/filesystem.h>
|
||||
|
||||
// Properties
|
||||
GLuint screenWidth = 800, screenHeight = 600;
|
||||
@@ -30,7 +31,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, GLboolean alpha = false);
|
||||
GLuint loadTexture(GLchar const * path, GLboolean alpha = false);
|
||||
GLuint generateAttachmentTexture(GLboolean depth, GLboolean stencil);
|
||||
|
||||
// Camera
|
||||
@@ -182,8 +183,8 @@ int main()
|
||||
glBindVertexArray(0);
|
||||
|
||||
// Load textures
|
||||
GLuint cubeTexture = loadTexture("../../../resources/textures/container.jpg");
|
||||
GLuint floorTexture = loadTexture("../../../resources/textures/metal.png");
|
||||
GLuint cubeTexture = loadTexture(FileSystem::getPath("resources/textures/container.jpg").c_str());
|
||||
GLuint floorTexture = loadTexture(FileSystem::getPath("resources/textures/metal.png").c_str());
|
||||
#pragma endregion
|
||||
|
||||
// Framebuffers
|
||||
@@ -291,7 +292,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, GLboolean alpha)
|
||||
GLuint loadTexture(GLchar const * path, GLboolean alpha)
|
||||
{
|
||||
//Generate texture ID and load texture data
|
||||
GLuint textureID;
|
||||
|
||||
Reference in New Issue
Block a user