OpenGL State Caching.

This commit is contained in:
Jonathas Costa
2020-07-31 15:59:28 -04:00
parent 11f537e2e2
commit 393fbdca3d
20 changed files with 95 additions and 365 deletions

View File

@@ -36,6 +36,7 @@
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/openglstatecache.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/opengl/textureunit.h>
@@ -823,23 +824,8 @@ void RenderableStars::renderPSFToTexture() {
GLint defaultFBO;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &defaultFBO);
GLint m_viewport[4];
glGetIntegerv(GL_VIEWPORT, m_viewport);
// Saving current OpenGL state
GLenum blendEquationRGB;
GLenum blendEquationAlpha;
GLenum blendDestAlpha;
GLenum blendDestRGB;
GLenum blendSrcAlpha;
GLenum blendSrcRGB;
glGetIntegerv(GL_BLEND_EQUATION_RGB, &blendEquationRGB);
glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &blendEquationAlpha);
glGetIntegerv(GL_BLEND_DST_ALPHA, &blendDestAlpha);
glGetIntegerv(GL_BLEND_DST_RGB, &blendDestRGB);
glGetIntegerv(GL_BLEND_SRC_ALPHA, &blendSrcAlpha);
glGetIntegerv(GL_BLEND_SRC_RGB, &blendSrcRGB);
// GLint m_viewport[4];
// global::renderEngine.openglStateCache().viewPort(m_viewport);
// Creates the FBO for the calculations
GLuint psfFBO;
@@ -941,8 +927,7 @@ void RenderableStars::renderPSFToTexture() {
//glDeleteFramebuffers(1, &convolveFBO);
// Restores OpenGL blending state
glBlendEquationSeparate(blendEquationRGB, blendEquationAlpha);
glBlendFuncSeparate(blendSrcRGB, blendDestRGB, blendSrcAlpha, blendDestAlpha);
global::renderEngine.openglStateCache().setBlendState();
}
void RenderableStars::render(const RenderData& data, RendererTasks&) {