mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 13:50:48 +00:00
Fixed potentially broken portal rendering after OpenGL context change
https://forum.zdoom.org/viewtopic.php?t=56393
This commit is contained in:
parent
7e7e1ff12e
commit
0c90253a5d
3 changed files with 23 additions and 1 deletions
|
@ -50,6 +50,7 @@
|
|||
#include "gl/data/gl_data.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/scene/gl_drawinfo.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
#include "gl/shaders/gl_shader.h"
|
||||
#include "gl/shaders/gl_ambientshader.h"
|
||||
#include "gl/shaders/gl_bloomshader.h"
|
||||
|
@ -184,10 +185,14 @@ void FGLRenderer::Initialize(int width, int height)
|
|||
mShaderManager = new FShaderManager;
|
||||
mSamplerManager = new FSamplerManager;
|
||||
gl_LoadModels();
|
||||
|
||||
GLPortal::Initialize();
|
||||
}
|
||||
|
||||
FGLRenderer::~FGLRenderer()
|
||||
{
|
||||
GLPortal::Shutdown();
|
||||
|
||||
gl_FlushModels();
|
||||
AActor::DeleteAllAttachedLights();
|
||||
FMaterial::FlushAll();
|
||||
|
|
|
@ -205,7 +205,6 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
|||
else if (gl_noquery) doquery = false;
|
||||
|
||||
// If occlusion query is supported let's use it to avoid rendering portals that aren't visible
|
||||
if (!QueryObject && doquery) glGenQueries(1, &QueryObject);
|
||||
if (QueryObject)
|
||||
{
|
||||
glBeginQuery(GL_SAMPLES_PASSED, QueryObject);
|
||||
|
@ -1264,6 +1263,21 @@ void GLEEHorizonPortal::DrawContents()
|
|||
|
||||
}
|
||||
|
||||
void GLPortal::Initialize()
|
||||
{
|
||||
assert(0 == QueryObject);
|
||||
glGenQueries(1, &QueryObject);
|
||||
}
|
||||
|
||||
void GLPortal::Shutdown()
|
||||
{
|
||||
if (0 != QueryObject)
|
||||
{
|
||||
glDeleteQueries(1, &QueryObject);
|
||||
QueryObject = 0;
|
||||
}
|
||||
}
|
||||
|
||||
const char *GLSkyPortal::GetName() { return "Sky"; }
|
||||
const char *GLSkyboxPortal::GetName() { return "Skybox"; }
|
||||
const char *GLSectorStackPortal::GetName() { return "Sectorstack"; }
|
||||
|
|
|
@ -177,6 +177,9 @@ public:
|
|||
static bool RenderFirstSkyPortal(int recursion);
|
||||
static void EndFrame();
|
||||
static GLPortal * FindPortal(const void * src);
|
||||
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
};
|
||||
|
||||
struct GLLinePortal : public GLPortal
|
||||
|
|
Loading…
Reference in a new issue