Resize should now be working correctly.
This commit is contained in:
@@ -24,6 +24,8 @@ public:
|
|||||||
|
|
||||||
void Draw(GLuint texture);
|
void Draw(GLuint texture);
|
||||||
|
|
||||||
|
void OnWindowRezise();
|
||||||
|
|
||||||
//Getters
|
//Getters
|
||||||
//Return the blurred result of the texture that was sent into draw
|
//Return the blurred result of the texture that was sent into draw
|
||||||
GLuint GaussianTexture() const { return m_GaussianTexture_vert; }
|
GLuint GaussianTexture() const { return m_GaussianTexture_vert; }
|
||||||
|
|||||||
@@ -121,6 +121,15 @@ void DrawBloomPass::Draw(GLuint texture)
|
|||||||
GLERROR("DrawBloomPass::Draw: END");
|
GLERROR("DrawBloomPass::Draw: END");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DrawBloomPass::OnWindowRezise()
|
||||||
|
{
|
||||||
|
GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||||
|
m_GaussianFrameBuffer_vert.Generate();
|
||||||
|
GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||||
|
m_GaussianFrameBuffer_horiz.Generate();
|
||||||
|
}
|
||||||
|
|
||||||
void DrawBloomPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
|
void DrawBloomPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
|
||||||
{
|
{
|
||||||
glGenTextures(1, texture);
|
glGenTextures(1, texture);
|
||||||
|
|||||||
@@ -277,7 +277,22 @@ void DrawFinalPass::ClearBuffer()
|
|||||||
|
|
||||||
void DrawFinalPass::OnWindowResize()
|
void DrawFinalPass::OnWindowResize()
|
||||||
{
|
{
|
||||||
InitializeFrameBuffers();
|
//InitializeFrameBuffers();
|
||||||
|
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer);
|
||||||
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||||
|
|
||||||
|
GenerateTexture(&m_SceneTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||||
|
GenerateTexture(&m_BloomTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||||
|
m_FinalPassFrameBuffer.Generate();
|
||||||
|
|
||||||
|
|
||||||
|
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBufferLowRes);
|
||||||
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, (int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate));
|
||||||
|
|
||||||
|
GenerateTexture(&m_SceneTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||||
|
GenerateTexture(&m_BloomTextureLowRes, GL_CLAMP_TO_EDGE, GL_NEAREST, glm::vec2((int)(m_Renderer->GetViewportSize().Width/m_ShieldPixelRate), (int)(m_Renderer->GetViewportSize().Height/m_ShieldPixelRate)), GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||||
|
m_FinalPassFrameBufferLowRes.Generate();
|
||||||
|
GLERROR("Error changing texture resolutions");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawFinalPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
|
void DrawFinalPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const
|
||||||
|
|||||||
@@ -72,7 +72,9 @@ void FrameBuffer::Generate()
|
|||||||
|
|
||||||
GLenum* bufferTextures = &attachments[0];
|
GLenum* bufferTextures = &attachments[0];
|
||||||
glDrawBuffers(attachments.size(), bufferTextures);
|
glDrawBuffers(attachments.size(), bufferTextures);
|
||||||
GLERROR("GLBufferAttachement error");
|
if (GLERROR("GLBufferAttachement error")) {
|
||||||
|
printf(": AttachmentSize %i", attachments.size());
|
||||||
|
}
|
||||||
|
|
||||||
if (GLenum frameBufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
if (GLenum frameBufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||||
GLERROR("Framebuffer incomplete");
|
GLERROR("Framebuffer incomplete");
|
||||||
|
|||||||
@@ -114,7 +114,28 @@ void LightCullingPass::FillLightList(RenderScene& scene)
|
|||||||
void LightCullingPass::OnWindowResize()
|
void LightCullingPass::OnWindowResize()
|
||||||
{
|
{
|
||||||
SetSSBOSizes();
|
SetSSBOSizes();
|
||||||
InitializeSSBOs();
|
|
||||||
|
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_FrustumSSBO);
|
||||||
|
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(Frustum)*m_NumberOfTiles, nullptr, GL_DYNAMIC_COPY);
|
||||||
|
GLERROR("m_FrustumSSBO");
|
||||||
|
|
||||||
|
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightSSBO);
|
||||||
|
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(LightSource) * 200, nullptr, GL_DYNAMIC_COPY);
|
||||||
|
GLERROR("m_LightSSBO");
|
||||||
|
|
||||||
|
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightGridSSBO);
|
||||||
|
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(LightGrid)*m_NumberOfTiles, nullptr, GL_DYNAMIC_COPY);
|
||||||
|
GLERROR("m_LightGridSSBO");
|
||||||
|
|
||||||
|
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightOffsetSSBO);
|
||||||
|
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(m_LightOffset), &m_LightOffset, GL_DYNAMIC_COPY);
|
||||||
|
GLERROR("m_LightOffsetSSBO");
|
||||||
|
|
||||||
|
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightIndexSSBO);
|
||||||
|
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(float)*m_NumberOfTiles*MAX_LIGHTS_PER_TILE, m_LightIndex, GL_DYNAMIC_COPY);
|
||||||
|
GLERROR("m_LightIndexSSBO");
|
||||||
|
|
||||||
|
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightCullingPass::InitializeSSBOs()
|
void LightCullingPass::InitializeSSBOs()
|
||||||
|
|||||||
@@ -371,7 +371,9 @@ void PickingPass::ClearPicking()
|
|||||||
void PickingPass::OnWindowResize()
|
void PickingPass::OnWindowResize()
|
||||||
{
|
{
|
||||||
InitializeTextures();
|
InitializeTextures();
|
||||||
InitializeFrameBuffers();
|
glBindRenderbuffer(GL_RENDERBUFFER, m_DepthBuffer);
|
||||||
|
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height);
|
||||||
|
m_PickingBuffer.Generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
PickData PickingPass::Pick(glm::vec2 screenCoord)
|
PickData PickingPass::Pick(glm::vec2 screenCoord)
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ void Renderer::glfwFrameBufferCallback(GLFWwindow* window, int width, int height
|
|||||||
currentRenderer->m_DrawFinalPass->OnWindowResize();
|
currentRenderer->m_DrawFinalPass->OnWindowResize();
|
||||||
currentRenderer->m_LightCullingPass->OnWindowResize();
|
currentRenderer->m_LightCullingPass->OnWindowResize();
|
||||||
currentRenderer->m_PickingPass->OnWindowResize();
|
currentRenderer->m_PickingPass->OnWindowResize();
|
||||||
|
currentRenderer->m_DrawBloomPass->OnWindowRezise();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::InitializeWindow()
|
void Renderer::InitializeWindow()
|
||||||
|
|||||||
Reference in New Issue
Block a user