Merge pull request #1029 from iChun/patch-1

Fixes stencil buffers on platforms not supporting OpenGL 3.0 or higher.
This commit is contained in:
LexManos 2014-04-07 10:43:02 -07:00
commit 2cef9c5cb2

View file

@ -8,14 +8,15 @@
import org.lwjgl.opengl.EXTFramebufferObject;
import org.lwjgl.opengl.GL11;
@@ -118,8 +119,8 @@
if (this.field_147619_e)
{
@@ -120,6 +121,11 @@
EXTFramebufferObject.glBindRenderbufferEXT(36161, this.field_147624_h);
- EXTFramebufferObject.glRenderbufferStorageEXT(36161, 33190, this.field_147622_a, this.field_147620_b);
- EXTFramebufferObject.glFramebufferRenderbufferEXT(36160, 36096, 36161, this.field_147624_h);
+ EXTFramebufferObject.glRenderbufferStorageEXT(36161, MinecraftForgeClient.getStencilBits() > 0 ? 35056 /* ARBFramebufferObject.GL_DEPTH24_STENCIL8 */ : 33190, this.field_147622_a, this.field_147620_b);
+ EXTFramebufferObject.glFramebufferRenderbufferEXT(36160, MinecraftForgeClient.getStencilBits() > 0 ? 33306 /* ARBFramebufferObject.GL_DEPTH_STENCIL_ATTACHMENT */ : 36096, 36161, this.field_147624_h);
EXTFramebufferObject.glRenderbufferStorageEXT(36161, 33190, this.field_147622_a, this.field_147620_b);
EXTFramebufferObject.glFramebufferRenderbufferEXT(36160, 36096, 36161, this.field_147624_h);
+ if(MinecraftForgeClient.getStencilBits() > 0)
+ {
+ EXTFramebufferObject.glRenderbufferStorageEXT(36161, EXTFramebufferObject.GL_STENCIL_INDEX8_EXT, this.field_147622_a, this.field_147620_b);
+ EXTFramebufferObject.glFramebufferRenderbufferEXT(36160, EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, 36161, this.field_147624_h);
+ }
}
this.func_147614_f();