mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-20 19:39:17 -05:00
OpenGL State Caching.
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <ghoul/opengl/openglstatecache.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
@@ -632,23 +633,6 @@ void RenderableGalaxy::renderPoints(const RenderData& data) {
|
||||
if (!_pointsProgram) {
|
||||
return;
|
||||
}
|
||||
// Saving current OpenGL state
|
||||
GLenum blendEquationRGB;
|
||||
GLenum blendEquationAlpha;
|
||||
GLenum blendDestAlpha;
|
||||
GLenum blendDestRGB;
|
||||
GLenum blendSrcAlpha;
|
||||
GLenum blendSrcRGB;
|
||||
GLboolean depthMask;
|
||||
|
||||
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);
|
||||
|
||||
glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
glDepthMask(false);
|
||||
@@ -697,14 +681,9 @@ void RenderableGalaxy::renderPoints(const RenderData& data) {
|
||||
|
||||
_pointsProgram->deactivate();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(true);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// Restores OpenGL blending state
|
||||
glBlendEquationSeparate(blendEquationRGB, blendEquationAlpha);
|
||||
glBlendFuncSeparate(blendSrcRGB, blendDestRGB, blendSrcAlpha, blendDestAlpha);
|
||||
glDepthMask(depthMask);
|
||||
// Restores OpenGL Rendering State
|
||||
global::renderEngine.openglStateCache().setBlendState();
|
||||
global::renderEngine.openglStateCache().setDepthState();
|
||||
}
|
||||
|
||||
void RenderableGalaxy::renderBillboards(const RenderData& data) {
|
||||
|
||||
Reference in New Issue
Block a user