mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- let the texture manager handle the special OpenGL textures so that they get deleted and recreated when needed.
This commit is contained in:
parent
80a0d15bc7
commit
ef55386d9f
5 changed files with 18 additions and 22 deletions
|
@ -459,8 +459,8 @@ bool gl_SetupLight(int group, Plane & p, ADynamicLight * light, FVector3 & nearP
|
|||
|
||||
bool gl_SetupLightTexture()
|
||||
{
|
||||
if (GLRenderer->gllight == nullptr) return false;
|
||||
FMaterial * pat = FMaterial::ValidateTexture(GLRenderer->gllight, false);
|
||||
if (!GLRenderer->glLight.isValid()) return false;
|
||||
FMaterial * pat = FMaterial::ValidateTexture(GLRenderer->glLight, false, false);
|
||||
gl_RenderState.SetMaterial(pat, CLAMP_XY_NOMIP, 0, -1, false);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -104,7 +104,6 @@ FGLRenderer::FGLRenderer(OpenGLFrameBuffer *fb)
|
|||
mSkyVBO = nullptr;
|
||||
gl_spriteindex = 0;
|
||||
mShaderManager = nullptr;
|
||||
gllight = glpart2 = glpart = mirrortexture = nullptr;
|
||||
mLights = nullptr;
|
||||
m2DDrawer = nullptr;
|
||||
mTonemapPalette = nullptr;
|
||||
|
@ -172,10 +171,10 @@ void FGLRenderer::Initialize(int width, int height)
|
|||
}
|
||||
else mVAOID = 0;
|
||||
|
||||
if (gl.legacyMode) gllight = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/gllight.png"), FTexture::TEX_MiscPatch);
|
||||
glpart2 = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart2.png"), FTexture::TEX_MiscPatch);
|
||||
glpart = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart.png"), FTexture::TEX_MiscPatch);
|
||||
mirrortexture = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/mirror.png"), FTexture::TEX_MiscPatch);
|
||||
if (gl.legacyMode) glLight = TexMan.CheckForTexture("glstuff/gllight.png", FTexture::TEX_MiscPatch);
|
||||
glPart2 = TexMan.CheckForTexture("glstuff/glpart2.png", FTexture::TEX_MiscPatch);
|
||||
glPart = TexMan.CheckForTexture("glstuff/glpart.png", FTexture::TEX_MiscPatch);
|
||||
mirrorTexture = TexMan.CheckForTexture("glstuff/mirror.png", FTexture::TEX_MiscPatch);
|
||||
|
||||
mVBO = new FFlatVertexBuffer(width, height);
|
||||
mSkyVBO = new FSkyVertexBuffer;
|
||||
|
@ -206,10 +205,6 @@ FGLRenderer::~FGLRenderer()
|
|||
if (mVBO != NULL) delete mVBO;
|
||||
if (mSkyVBO != NULL) delete mSkyVBO;
|
||||
if (mLights != NULL) delete mLights;
|
||||
if (glpart2) delete glpart2;
|
||||
if (glpart) delete glpart;
|
||||
if (gllight) delete gllight;
|
||||
if (mirrortexture) delete mirrortexture;
|
||||
if (mFBID != 0) glDeleteFramebuffers(1, &mFBID);
|
||||
if (mVAOID != 0)
|
||||
{
|
||||
|
|
|
@ -133,10 +133,10 @@ public:
|
|||
|
||||
FShadowMap mShadowMap;
|
||||
|
||||
FTexture *gllight;
|
||||
FTexture *glpart2;
|
||||
FTexture *glpart;
|
||||
FTexture *mirrortexture;
|
||||
FTextureID glLight;
|
||||
FTextureID glPart2;
|
||||
FTextureID glPart;
|
||||
FTextureID mirrorTexture;
|
||||
|
||||
float mSky1Pos, mSky2Pos;
|
||||
|
||||
|
|
|
@ -1185,19 +1185,20 @@ void GLSprite::ProcessParticle (particle_t *particle, sector_t *sector)//, int s
|
|||
// [BB] Load the texture for round or smooth particles
|
||||
if (gl_particles_style)
|
||||
{
|
||||
FTexture *lump = NULL;
|
||||
FTextureID lump;
|
||||
if (gl_particles_style == 1)
|
||||
{
|
||||
lump = GLRenderer->glpart2;
|
||||
lump = GLRenderer->glPart2;
|
||||
}
|
||||
else if (gl_particles_style == 2)
|
||||
{
|
||||
lump = GLRenderer->glpart;
|
||||
lump = GLRenderer->glPart;
|
||||
}
|
||||
else lump.SetNull();
|
||||
|
||||
if (lump != NULL)
|
||||
if (lump.isValid())
|
||||
{
|
||||
gltexture = FMaterial::ValidateTexture(lump, true);
|
||||
gltexture = FMaterial::ValidateTexture(lump, true, false);
|
||||
translation = 0;
|
||||
|
||||
ul = gltexture->GetUL();
|
||||
|
|
|
@ -260,7 +260,7 @@ void GLWall::RenderFogBoundary()
|
|||
//==========================================================================
|
||||
void GLWall::RenderMirrorSurface()
|
||||
{
|
||||
if (GLRenderer->mirrortexture == NULL) return;
|
||||
if (!GLRenderer->mirrorTexture.isValid()) return;
|
||||
|
||||
// For the sphere map effect we need a normal of the mirror surface,
|
||||
FVector3 v = glseg.Normal();
|
||||
|
@ -288,7 +288,7 @@ void GLWall::RenderMirrorSurface()
|
|||
gl_RenderState.AlphaFunc(GL_GREATER,0);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
|
||||
FMaterial * pat=FMaterial::ValidateTexture(GLRenderer->mirrortexture, false);
|
||||
FMaterial * pat=FMaterial::ValidateTexture(GLRenderer->mirrorTexture, false, false);
|
||||
gl_RenderState.SetMaterial(pat, CLAMP_NONE, 0, -1, false);
|
||||
|
||||
flags &= ~GLWF_GLOW;
|
||||
|
|
Loading…
Reference in a new issue