mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-02 04:37:54 +08:00
Merge pull request #39 from xiaofeii2/master
Fixed bug: cannot load images in vs2015.
This commit is contained in:
@@ -32,7 +32,7 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
|
||||
void mouse_callback(GLFWwindow* window, double xpos, double ypos);
|
||||
void Do_Movement();
|
||||
GLuint loadTexture(GLchar const * path);
|
||||
GLuint loadCubemap(std::vector<const GLchar*> faces);
|
||||
GLuint loadCubemap(std::vector<std::string> faces);
|
||||
|
||||
// Camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
@@ -198,13 +198,13 @@ int main()
|
||||
#pragma endregion
|
||||
|
||||
// Cubemap (Skybox)
|
||||
std::vector<const GLchar*> faces;
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/right.jpg").c_str());
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/left.jpg").c_str());
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/top.jpg").c_str());
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/bottom.jpg").c_str());
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/back.jpg").c_str());
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/front.jpg").c_str());
|
||||
std::vector<std::string> faces;
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/right.jpg"));
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/left.jpg"));
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/top.jpg"));
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/bottom.jpg"));
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/back.jpg"));
|
||||
faces.push_back(FileSystem::getPath("resources/textures/skybox/front.jpg"));
|
||||
GLuint skyboxTexture = loadCubemap(faces);
|
||||
|
||||
// Draw as wireframe
|
||||
@@ -272,7 +272,7 @@ int main()
|
||||
// -Y (bottom)
|
||||
// +Z (front)? (CHECK THIS)
|
||||
// -Z (back)?
|
||||
GLuint loadCubemap(std::vector<const GLchar*> faces)
|
||||
GLuint loadCubemap(std::vector<std::string> faces)
|
||||
{
|
||||
GLuint textureID;
|
||||
glGenTextures(1, &textureID);
|
||||
@@ -284,7 +284,7 @@ GLuint loadCubemap(std::vector<const GLchar*> faces)
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
|
||||
for (GLuint i = 0; i < faces.size(); i++)
|
||||
{
|
||||
image = SOIL_load_image(faces[i], &width, &height, 0, SOIL_LOAD_RGB);
|
||||
image = SOIL_load_image(faces[i].c_str(), &width, &height, 0, SOIL_LOAD_RGB);
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
|
||||
}
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
Reference in New Issue
Block a user