mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
Fix binding error that Nvidia didn't complain about but Intel on Mac does
This commit is contained in:
parent
c93204cace
commit
b789aaa0eb
2 changed files with 14 additions and 8 deletions
|
@ -183,12 +183,12 @@ void FGLRenderBuffers::CreateScene(int width, int height, int samples)
|
|||
{
|
||||
mSceneDepth = CreateRenderBuffer(GL_DEPTH_COMPONENT24, samples, width, height);
|
||||
mSceneStencil = CreateRenderBuffer(GL_STENCIL_INDEX8, samples, width, height);
|
||||
mSceneFB = CreateFrameBuffer(samples > 1 ? mSceneMultisample : mSceneTexture, mSceneDepth, mSceneStencil);
|
||||
mSceneFB = CreateFrameBuffer(samples > 1 ? mSceneMultisample : mSceneTexture, mSceneDepth, mSceneStencil, samples > 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mSceneDepthStencil = CreateRenderBuffer(GL_DEPTH24_STENCIL8, samples, width, height);
|
||||
mSceneFB = CreateFrameBuffer(samples > 1 ? mSceneMultisample : mSceneTexture, mSceneDepthStencil);
|
||||
mSceneFB = CreateFrameBuffer(samples > 1 ? mSceneMultisample : mSceneTexture, mSceneDepthStencil, samples > 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,22 +327,28 @@ GLuint FGLRenderBuffers::CreateFrameBuffer(GLuint colorbuffer)
|
|||
return handle;
|
||||
}
|
||||
|
||||
GLuint FGLRenderBuffers::CreateFrameBuffer(GLuint colorbuffer, GLuint depthstencil)
|
||||
GLuint FGLRenderBuffers::CreateFrameBuffer(GLuint colorbuffer, GLuint depthstencil, bool colorIsARenderBuffer)
|
||||
{
|
||||
GLuint handle = 0;
|
||||
glGenFramebuffers(1, &handle);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, handle);
|
||||
if (colorIsARenderBuffer)
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorbuffer);
|
||||
else
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorbuffer, 0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, depthstencil);
|
||||
CheckFrameBufferCompleteness();
|
||||
return handle;
|
||||
}
|
||||
|
||||
GLuint FGLRenderBuffers::CreateFrameBuffer(GLuint colorbuffer, GLuint depth, GLuint stencil)
|
||||
GLuint FGLRenderBuffers::CreateFrameBuffer(GLuint colorbuffer, GLuint depth, GLuint stencil, bool colorIsARenderBuffer)
|
||||
{
|
||||
GLuint handle = 0;
|
||||
glGenFramebuffers(1, &handle);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, handle);
|
||||
if (colorIsARenderBuffer)
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorbuffer);
|
||||
else
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorbuffer, 0);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth);
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, stencil);
|
||||
|
|
|
@ -45,8 +45,8 @@ private:
|
|||
GLuint CreateRenderBuffer(GLuint format, int width, int height);
|
||||
GLuint CreateRenderBuffer(GLuint format, int samples, int width, int height);
|
||||
GLuint CreateFrameBuffer(GLuint colorbuffer);
|
||||
GLuint CreateFrameBuffer(GLuint colorbuffer, GLuint depthstencil);
|
||||
GLuint CreateFrameBuffer(GLuint colorbuffer, GLuint depth, GLuint stencil);
|
||||
GLuint CreateFrameBuffer(GLuint colorbuffer, GLuint depthstencil, bool colorIsARenderBuffer);
|
||||
GLuint CreateFrameBuffer(GLuint colorbuffer, GLuint depth, GLuint stencil, bool colorIsARenderBuffer);
|
||||
void CheckFrameBufferCompleteness();
|
||||
void DeleteTexture(GLuint &handle);
|
||||
void DeleteRenderBuffer(GLuint &handle);
|
||||
|
|
Loading…
Reference in a new issue