Search in sources :

Example 1 with Framebuffer

use of net.minecraft.client.shader.Framebuffer in project malmo by Microsoft.

the class ColourMapProducerImplementation method prepare.

@Override
public void prepare(MissionInit missionInit) {
    this.fbo = new Framebuffer(this.getWidth(), this.getHeight(), true);
    TextureHelper.setIsProducingColourMap(true);
    TextureHelper.setMobColours(this.mobColours);
    TextureHelper.setMiscTextureColours(this.miscColours);
    TextureHelper.setSkyRenderer(new TextureHelper.BlankSkyRenderer(this.cmParams.getSkyColour()));
}
Also used : Framebuffer(net.minecraft.client.shader.Framebuffer) TextureHelper(com.microsoft.Malmo.Utils.TextureHelper)

Example 2 with Framebuffer

use of net.minecraft.client.shader.Framebuffer in project malmo by Microsoft.

the class VideoProducerImplementation method prepare.

@Override
public void prepare(MissionInit missionInit) {
    this.fbo = new Framebuffer(this.videoParams.getWidth(), this.videoParams.getHeight(), true);
    // Create a buffer for retrieving the depth map, if requested:
    if (this.videoParams.isWantDepth())
        this.depthBuffer = BufferUtils.createFloatBuffer(this.videoParams.getWidth() * this.videoParams.getHeight());
    // Set the requested camera position
    Minecraft.getMinecraft().gameSettings.thirdPersonView = this.videoParams.getViewpoint();
}
Also used : Framebuffer(net.minecraft.client.shader.Framebuffer)

Example 3 with Framebuffer

use of net.minecraft.client.shader.Framebuffer in project Armourers-Workshop by RiskyKen.

the class GuiBookBase method enablePageFramebuffer.

protected void enablePageFramebuffer() {
    mc.getFramebuffer().unbindFramebuffer();
    ScaledResolution reso = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    double scaleWidth = (double) mc.displayWidth / reso.getScaledWidth_double();
    double scaleHeight = (double) mc.displayHeight / reso.getScaledHeight_double();
    int fboScaledWidth = MathHelper.ceiling_double_int(256 * scaleWidth);
    int fboScaledHeight = MathHelper.ceiling_double_int(256 * scaleHeight);
    if (fbo == null) {
        fbo = new Framebuffer(fboScaledWidth, fboScaledHeight, true);
        fbo.setFramebufferColor(0, 0, 0, 0);
    }
    if (fbo.framebufferWidth != fboScaledWidth | fbo.framebufferHeight != fboScaledHeight) {
        fbo.createFramebuffer(fboScaledWidth, fboScaledHeight);
        ModLogger.log("resizing fbo to scale: " + scaleHeight);
    }
    OpenGlHelper.func_153171_g(OpenGlHelper.field_153198_e, fbo.framebufferObject);
    GL11.glClearColor(0F, 0F, 0F, 0F);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glClearDepth(1.0D);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glOrtho(0D, 256D, 256D, 0D, 1000D, 3000.0D);
    GL11.glViewport(0, 0, fboScaledWidth, fboScaledHeight);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glClearColor(0, 0, 0, 0);
    ModRenderHelper.enableAlphaBlend();
    GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
// OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
Also used : Framebuffer(net.minecraft.client.shader.Framebuffer) ScaledResolution(net.minecraft.client.gui.ScaledResolution)

Example 4 with Framebuffer

use of net.minecraft.client.shader.Framebuffer in project Galacticraft by micdoodle8.

the class GuiItemIconDumper method screenshot.

private BufferedImage screenshot() {
    Framebuffer fb = Minecraft.getMinecraft().getFramebuffer();
    Dimension mcSize = GuiDraw.displayRes();
    Dimension texSize = mcSize;
    if (OpenGlHelper.isFramebufferEnabled()) {
        texSize = new Dimension(fb.framebufferTextureWidth, fb.framebufferTextureHeight);
    }
    int k = texSize.width * texSize.height;
    if (pixelBuffer == null || pixelBuffer.capacity() < k) {
        pixelBuffer = BufferUtils.createIntBuffer(k);
        pixelValues = new int[k];
    }
    GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
    GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
    pixelBuffer.clear();
    if (OpenGlHelper.isFramebufferEnabled()) {
        GlStateManager.bindTexture(fb.framebufferTexture);
        GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
    } else {
        GL11.glReadPixels(0, 0, texSize.width, texSize.height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
    }
    pixelBuffer.get(pixelValues);
    TextureUtil.processPixelValues(pixelValues, texSize.width, texSize.height);
    BufferedImage img = new BufferedImage(mcSize.width, mcSize.height, BufferedImage.TYPE_INT_ARGB);
    if (OpenGlHelper.isFramebufferEnabled()) {
        int yOff = texSize.height - mcSize.height;
        for (int y = 0; y < mcSize.height; ++y) {
            for (int x = 0; x < mcSize.width; ++x) {
                img.setRGB(x, y, pixelValues[(y + yOff) * texSize.width + x]);
            }
        }
    } else {
        img.setRGB(0, 0, texSize.width, height, pixelValues, 0, texSize.width);
    }
    return img;
}
Also used : Framebuffer(net.minecraft.client.shader.Framebuffer) BufferedImage(java.awt.image.BufferedImage)

Example 5 with Framebuffer

use of net.minecraft.client.shader.Framebuffer in project DynamicSurroundings by OreCruncher.

the class FrameBufferShader method setSize.

public void setSize(final int width, final int height) {
    if (this.blit != null && (this.blit.framebufferWidth != width || this.blit.framebufferHeight != height)) {
        release();
    }
    if (this.blit == null) {
        this.blit = new Framebuffer(width, height, false);
        this.blit.setFramebufferColor(0F, 0F, 0F, 0F);
    }
}
Also used : Framebuffer(net.minecraft.client.shader.Framebuffer)

Aggregations

Framebuffer (net.minecraft.client.shader.Framebuffer)10 ScaledResolution (net.minecraft.client.gui.ScaledResolution)2 MultiLayerLoader (blusunrize.immersiveengineering.client.models.multilayer.MultiLayerLoader)1 ConnLoader (blusunrize.immersiveengineering.client.models.smart.ConnLoader)1 FeedthroughLoader (blusunrize.immersiveengineering.client.models.smart.FeedthroughLoader)1 Matrix4 (blusunrize.immersiveengineering.common.util.chickenbones.Matrix4)1 PositionedItemStack (blusunrize.lib.manual.ManualPages.PositionedItemStack)1 TextureHelper (com.microsoft.Malmo.Utils.TextureHelper)1 BufferedImage (java.awt.image.BufferedImage)1 IntBuffer (java.nio.IntBuffer)1 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)1 Tessellator (net.minecraft.client.renderer.Tessellator)1 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)1 ResourceLocation (net.minecraft.util.ResourceLocation)1