mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-02 04:37:54 +08:00
@@ -273,7 +273,7 @@ int main()
|
|||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
glDisable(GL_DEPTH_TEST); // disable depth test so screen-space quad isn't discarded due to depth test.
|
glDisable(GL_DEPTH_TEST); // disable depth test so screen-space quad isn't discarded due to depth test.
|
||||||
// clear all relevant buffers
|
// clear all relevant buffers
|
||||||
glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // set clear color to white (not really necessery actually, since we won't be able to see behind the quad anyways)
|
glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // set clear color to white (not really necessary actually, since we won't be able to see behind the quad anyways)
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
screenShader.use();
|
screenShader.use();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <learnopengl/shader.h>
|
#include <learnopengl/shader.h>
|
||||||
#include <learnopengl/camera.h>
|
#include <learnopengl/camera.h>
|
||||||
|
|
||||||
// GLM Mathemtics
|
// GLM Mathematics
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ int main()
|
|||||||
unsigned int hdrFBO;
|
unsigned int hdrFBO;
|
||||||
glGenFramebuffers(1, &hdrFBO);
|
glGenFramebuffers(1, &hdrFBO);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, hdrFBO);
|
glBindFramebuffer(GL_FRAMEBUFFER, hdrFBO);
|
||||||
// create 2 floating point color buffers (1 for normal rendering, other for brightness treshold values)
|
// create 2 floating point color buffers (1 for normal rendering, other for brightness threshold values)
|
||||||
unsigned int colorBuffers[2];
|
unsigned int colorBuffers[2];
|
||||||
glGenTextures(2, colorBuffers);
|
glGenTextures(2, colorBuffers);
|
||||||
for (unsigned int i = 0; i < 2; i++)
|
for (unsigned int i = 0; i < 2; i++)
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ int main()
|
|||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // be sure to set minifcation filter to mip_linear
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // be sure to set minification filter to mip_linear
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
// generate mipmaps for the cubemap so OpenGL automatically allocates the required memory.
|
// generate mipmaps for the cubemap so OpenGL automatically allocates the required memory.
|
||||||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ int main()
|
|||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // be sure to set minifcation filter to mip_linear
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // be sure to set minification filter to mip_linear
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
// generate mipmaps for the cubemap so OpenGL automatically allocates the required memory.
|
// generate mipmaps for the cubemap so OpenGL automatically allocates the required memory.
|
||||||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ void GameLevel::Load(const char *file, unsigned int levelWidth, unsigned int lev
|
|||||||
{
|
{
|
||||||
std::istringstream sstream(line);
|
std::istringstream sstream(line);
|
||||||
std::vector<unsigned int> row;
|
std::vector<unsigned int> row;
|
||||||
while (sstream >> tileCode) // read each word seperated by spaces
|
while (sstream >> tileCode) // read each word separated by spaces
|
||||||
row.push_back(tileCode);
|
row.push_back(tileCode);
|
||||||
tileData.push_back(row);
|
tileData.push_back(row);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// GLFW function declerations
|
// GLFW function declarations
|
||||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
|
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
|
||||||
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);
|
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// GLFW function declerations
|
// GLFW function declarations
|
||||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
|
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
|
||||||
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);
|
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ void Shader::Compile(const char* vertexSource, const char* fragmentSource, const
|
|||||||
glAttachShader(this->ID, gShader);
|
glAttachShader(this->ID, gShader);
|
||||||
glLinkProgram(this->ID);
|
glLinkProgram(this->ID);
|
||||||
checkCompileErrors(this->ID, "PROGRAM");
|
checkCompileErrors(this->ID, "PROGRAM");
|
||||||
// delete the shaders as they're linked into our program now and no longer necessery
|
// delete the shaders as they're linked into our program now and no longer necessary
|
||||||
glDeleteShader(sVertex);
|
glDeleteShader(sVertex);
|
||||||
glDeleteShader(sFragment);
|
glDeleteShader(sFragment);
|
||||||
if (geometrySource != nullptr)
|
if (geometrySource != nullptr)
|
||||||
|
|||||||
Reference in New Issue
Block a user