本文整理汇总了Java中net.minecraft.client.shader.Framebuffer.unbindFramebufferTexture方法的典型用法代码示例。如果您正苦于以下问题:Java Framebuffer.unbindFramebufferTexture方法的具体用法?Java Framebuffer.unbindFramebufferTexture怎么用?Java Framebuffer.unbindFramebufferTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.shader.Framebuffer
的用法示例。
在下文中一共展示了Framebuffer.unbindFramebufferTexture方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readPixels
import net.minecraft.client.shader.Framebuffer; //导入方法依赖的package包/类
public void readPixels(boolean fbo, boolean pbo) {
buffer.rewind();
// set alignment flags
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
// read texture from framebuffer if enabled, otherwise use slower
// glReadPixels
if (fbo) {
Framebuffer fb = MC.getFramebuffer();
fb.bindFramebufferTexture();
if (pbo) {
glGetTexImage(GL_TEXTURE_2D, 0, FORMAT, TYPE, 0);
} else {
glGetTexImage(GL_TEXTURE_2D, 0, FORMAT, TYPE, buffer);
}
fb.unbindFramebufferTexture();
} else {
if (pbo) {
glReadPixels(0, 0, width, height, FORMAT, TYPE, 0);
} else {
glReadPixels(0, 0, width, height, FORMAT, TYPE, buffer);
}
}
}
示例2: vrGUIRender
import net.minecraft.client.shader.Framebuffer; //导入方法依赖的package包/类
public void vrGUIRender( )
{
this.mc.mcProfiler.startSection("vr-gui-render");
Framebuffer fbGUI = this.mc.getFramebuffer();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GL11.glTranslatef(0.0F, 0.0F, -10.0F);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
fbGUI.bindFramebufferTexture();
double scale = 3;
double aspectRatio = 2*this.mc.displayWidth/(double)this.mc.displayHeight;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(-1);
tessellator.addVertexWithUV( scale*aspectRatio, scale, 0.0D, 1.0D, 1.0D);
tessellator.addVertexWithUV(-scale*aspectRatio, scale, 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV(-scale*aspectRatio, -scale, 0.0D, 0.0D, 0.0D);
tessellator.addVertexWithUV( scale*aspectRatio, -scale, 0.0D, 1.0D, 0.0D);
tessellator.draw();
fbGUI.unbindFramebufferTexture();
GL11.glDepthMask(true);
this.mc.mcProfiler.endSection();
}
示例3: func_152922_k
import net.minecraft.client.shader.Framebuffer; //导入方法依赖的package包/类
public void func_152922_k()
{
if (this.broadcastController.isBroadcasting() && !this.broadcastController.isBroadcastPaused())
{
long i = System.nanoTime();
long j = (long)(1000000000 / this.targetFPS);
long k = i - this.field_152959_k;
boolean flag = k >= j;
if (flag)
{
FrameBuffer framebuffer = this.broadcastController.func_152822_N();
Framebuffer framebuffer1 = this.mc.getFramebuffer();
this.framebuffer.bindFramebuffer(true);
GlStateManager.matrixMode(5889);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)this.framebuffer.framebufferWidth, (double)this.framebuffer.framebufferHeight, 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.viewport(0, 0, this.framebuffer.framebufferWidth, this.framebuffer.framebufferHeight);
GlStateManager.enableTexture2D();
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
float f = (float)this.framebuffer.framebufferWidth;
float f1 = (float)this.framebuffer.framebufferHeight;
float f2 = (float)framebuffer1.framebufferWidth / (float)framebuffer1.framebufferTextureWidth;
float f3 = (float)framebuffer1.framebufferHeight / (float)framebuffer1.framebufferTextureHeight;
framebuffer1.bindFramebufferTexture();
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, 9729.0F);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, 9729.0F);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos(0.0D, (double)f1, 0.0D).tex(0.0D, (double)f3).endVertex();
worldrenderer.pos((double)f, (double)f1, 0.0D).tex((double)f2, (double)f3).endVertex();
worldrenderer.pos((double)f, 0.0D, 0.0D).tex((double)f2, 0.0D).endVertex();
worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).endVertex();
tessellator.draw();
framebuffer1.unbindFramebufferTexture();
GlStateManager.popMatrix();
GlStateManager.matrixMode(5889);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
this.broadcastController.captureFramebuffer(framebuffer);
this.framebuffer.unbindFramebuffer();
this.broadcastController.submitStreamFrame(framebuffer);
this.field_152959_k = i;
}
}
}
示例4: func_152922_k
import net.minecraft.client.shader.Framebuffer; //导入方法依赖的package包/类
public void func_152922_k()
{
if (this.field_152951_c.func_152850_m() && !this.field_152951_c.func_152839_p())
{
long i = System.nanoTime();
long j = (long)(1000000000 / this.field_152958_j);
long k = i - this.field_152959_k;
boolean flag = k >= j;
if (flag)
{
FrameBuffer framebuffer = this.field_152951_c.func_152822_N();
Framebuffer framebuffer1 = this.field_152953_e.getFramebuffer();
this.field_152956_h.bindFramebuffer(true);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glOrtho(0.0D, (double)this.field_152956_h.framebufferWidth, (double)this.field_152956_h.framebufferHeight, 0.0D, 1000.0D, 3000.0D);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPushMatrix();
GL11.glLoadIdentity();
GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glViewport(0, 0, this.field_152956_h.framebufferWidth, this.field_152956_h.framebufferHeight);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
float f = (float)this.field_152956_h.framebufferWidth;
float f1 = (float)this.field_152956_h.framebufferHeight;
float f2 = (float)framebuffer1.framebufferWidth / (float)framebuffer1.framebufferTextureWidth;
float f3 = (float)framebuffer1.framebufferHeight / (float)framebuffer1.framebufferTextureHeight;
framebuffer1.bindFramebufferTexture();
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, 9729.0F);
GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, 9729.0F);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0.0D, (double)f1, 0.0D, 0.0D, (double)f3);
tessellator.addVertexWithUV((double)f, (double)f1, 0.0D, (double)f2, (double)f3);
tessellator.addVertexWithUV((double)f, 0.0D, 0.0D, (double)f2, 0.0D);
tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
tessellator.draw();
framebuffer1.unbindFramebufferTexture();
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
this.field_152951_c.func_152846_a(framebuffer);
this.field_152956_h.unbindFramebuffer();
this.field_152951_c.func_152859_b(framebuffer);
this.field_152959_k = i;
}
}
}