mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 23:32:02 +00:00
Restore bound texture when FGLRenderBuffers::Setup finishes
This commit is contained in:
parent
94b72d25e9
commit
fd4422eb62
1 changed files with 11 additions and 5 deletions
|
@ -149,6 +149,12 @@ void FGLRenderBuffers::Setup(int width, int height, int sceneWidth, int sceneHei
|
||||||
|
|
||||||
int samples = GetCvarSamples();
|
int samples = GetCvarSamples();
|
||||||
|
|
||||||
|
GLint activeTex;
|
||||||
|
GLint textureBinding;
|
||||||
|
glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTex);
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, &textureBinding);
|
||||||
|
|
||||||
if (width == mWidth && height == mHeight && mSamples != samples)
|
if (width == mWidth && height == mHeight && mSamples != samples)
|
||||||
{
|
{
|
||||||
CreateScene(mWidth, mHeight, samples);
|
CreateScene(mWidth, mHeight, samples);
|
||||||
|
@ -171,8 +177,8 @@ void FGLRenderBuffers::Setup(int width, int height, int sceneWidth, int sceneHei
|
||||||
mBloomHeight = sceneHeight;
|
mBloomHeight = sceneHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glBindTexture(GL_TEXTURE_BINDING_2D, textureBinding);
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glActiveTexture(activeTex);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
}
|
}
|
||||||
|
@ -293,7 +299,6 @@ GLuint FGLRenderBuffers::Create2DTexture(GLuint format, int width, int height)
|
||||||
GLuint type = (format == GL_RGBA16F) ? GL_FLOAT : GL_UNSIGNED_BYTE;
|
GLuint type = (format == GL_RGBA16F) ? GL_FLOAT : GL_UNSIGNED_BYTE;
|
||||||
GLuint handle = 0;
|
GLuint handle = 0;
|
||||||
glGenTextures(1, &handle);
|
glGenTextures(1, &handle);
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, handle);
|
glBindTexture(GL_TEXTURE_2D, handle);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, GL_RGBA, type, nullptr);
|
glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, GL_RGBA, type, nullptr);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
@ -414,9 +419,10 @@ void FGLRenderBuffers::CheckFrameBufferCompleteness()
|
||||||
|
|
||||||
void FGLRenderBuffers::ClearFrameBuffer()
|
void FGLRenderBuffers::ClearFrameBuffer()
|
||||||
{
|
{
|
||||||
GLint scissorEnabled, stencilValue;
|
GLboolean scissorEnabled;
|
||||||
|
GLint stencilValue;
|
||||||
GLdouble depthValue;
|
GLdouble depthValue;
|
||||||
glGetIntegerv(GL_SCISSOR_TEST, &scissorEnabled);
|
glGetBooleanv(GL_SCISSOR_TEST, &scissorEnabled);
|
||||||
glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &stencilValue);
|
glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &stencilValue);
|
||||||
glGetDoublev(GL_DEPTH_CLEAR_VALUE, &depthValue);
|
glGetDoublev(GL_DEPTH_CLEAR_VALUE, &depthValue);
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
|
Loading…
Reference in a new issue