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()));
}
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();
}
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);
}
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;
}
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);
}
}
Aggregations