Rendering world behaves weirdly
-
Hello, i need help with rendering the world on a framebuffer. The world rendered (with mc.entityRenderer.renderWorld()) renders weirdly, i already tried enabling and disabling depth and other couple of things, i am not sure if using a framebuffer messes with it, i'm in 1.8.9 Vanilla (No forge). (and yes, i'm trying to render the world twice, for having a different camera server side). I figured here is the only place i know that can support me, so sorry if this comes off as an useless post.
My code:
GlStateManager.color(1, 1, 1, 1); GlStateManager.enableTexture2D(); GL11.glPushMatrix(); /* Bind custom framebuffer */ GL11.glPushMatrix(); float py = mc.getRenderViewEntity().rotationYaw; float pp = mc.getRenderViewEntity().rotationPitch; float ppy = mc.getRenderViewEntity().prevRotationYaw; float ppp = mc.getRenderViewEntity().prevRotationPitch; boolean c = mc.gameSettings.thirdPersonView; mc.gameSettings.thirdPersonView = false; mc.getRenderViewEntity().rotationYaw = mc.getRenderViewEntity().prevRotationYaw = ((Rotations) (LiquidBounce.getModuleManager().getModule("Rotations"))).yaw; mc.getRenderViewEntity().rotationPitch = mc.getRenderViewEntity().prevRotationPitch = ((Rotations) (LiquidBounce.getModuleManager().getModule("Rotations"))).pitch; Framebuffer fb = mc.getFramebuffer(); mc.setFrameBuffer(framebuffer); GlStateManager.disableBlend(); mc.entityRenderer.renderWorld(partialTicks, System.nanoTime()); GlStateManager.enableBlend(); mc.setFrameBuffer(fb); mc.getRenderViewEntity().rotationYaw = py; mc.getRenderViewEntity().rotationPitch = pp; mc.getRenderViewEntity().prevRotationYaw = ppy; mc.getRenderViewEntity().prevRotationPitch = ppp; mc.gameSettings.thirdPersonView = c; mc.entityRenderer.setupOverlayRendering(); GL11.glPopMatrix(); /* Unbind custom framebuffer */ GlStateManager.popMatrix(); /* Bind minecraft's default framebuffer */
-
Found the fix myself, i created the framebuffer with
new Framebuffer(width, height, false)
instead of
new Framebuffer(width, height, true)
which enables the depth... i should've known better