@Override
    public void drawBack(GuiGraphics graphics, Point mouse, float partialFrame) {

        // Set up projection and view matrices
        Rect glFrame = getGlFrame();
        pvMatrix.setProjection(getVerticalFOV(), glFrame.width(), glFrame.height(), 0.2F, getMaxRenderDist());
        pvMatrix.setView(getCameraPosition().x, getCameraPosition().y, getCameraPosition().z, 90 * MathHelper.torad, 0);

        // Save viewport state
        int glvpH = GlStateManager.Viewport.height();
        int glvpW = GlStateManager.Viewport.width();
        int glvpX = GlStateManager.Viewport.x();
        int glvpY = GlStateManager.Viewport.y();

        // Create a new viewport
        RenderSystem.viewport(glFrame.x(), glFrame.y(), glFrame.width(), glFrame.height());

        // Apply projection matrix
        RenderSystem.backupProjectionMatrix();
        RenderSystem.setProjectionMatrix(pvMatrix.getProjectionMatrix().toMatrix4f(), VertexSorting.ORTHOGRAPHIC_Z);

        PoseStack mvStack = RenderSystem.getModelViewStack();
        mvStack.pushPose();
        mvStack.setIdentity();
        RenderSystem.applyModelViewMatrix();

        /*
          TODO Figure out how to sandwich the viewport at this node's z position, +- some small range.
               For now, this only renders properly if correctly ordered in the tree (i.e. everything
               under it renders before, and everything above it renders after).
         */
        RenderSystem.clear(GL11.GL_DEPTH_BUFFER_BIT, false);

        // Render
        PoseStack pStack = pvMatrix.getModelViewMatrixStack();
        renderInViewport(pStack, getFrame().ndc(mouse), partialFrame, isFirstHit(mouse));

        // Restore previous matrices
        mvStack.popPose();
        RenderSystem.applyModelViewMatrix();

        RenderSystem.restoreProjectionMatrix();

        // Restore previous viewport
        RenderSystem.viewport(glvpX, glvpY, glvpW, glvpH);
    }
Renders a viewport within the node frame. Overrides provided to obtain the camera position fov, etc.
core/src/main/java/mrtjp/projectred/redui/ViewportRenderNode.java