CCBlueX Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Rendering world behaves weirdly

    Kotlin/Java
    1
    2
    95
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      ThrowAway39234 last edited by

      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.
      23eecf7b-e234-4f22-bad7-d70fd1113064-image.png

      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 */
      
      1 Reply Last reply Reply Quote 0
      • T
        ThrowAway39234 last edited by

        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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        About
        • Terms of Service
        • Privacy Policy
        • Status
        • Contact Us
        Downloads
        • Releases
        • Source code
        • License
        Docs
        • Tutorials
        • CustomHUD
        • AutoSettings
        • ScriptAPI
        Community
        • Forum
        • Guilded
        • YouTube
        • Twitter
        • D.Tube