本文整理汇总了Java中net.minecraft.client.renderer.GlStateManager.viewport方法的典型用法代码示例。如果您正苦于以下问题:Java GlStateManager.viewport方法的具体用法?Java GlStateManager.viewport怎么用?Java GlStateManager.viewport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.GlStateManager
的用法示例。
在下文中一共展示了GlStateManager.viewport方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAchievementWindowScale
import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
private void updateAchievementWindowScale()
{
GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
this.width = this.mc.displayWidth;
this.height = this.mc.displayHeight;
ScaledResolution scaledresolution = new ScaledResolution(this.mc);
this.width = scaledresolution.getScaledWidth();
this.height = scaledresolution.getScaledHeight();
GlStateManager.clear(256);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)this.width, (double)this.height, 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
}
示例2: renderSkybox
import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
/**
* Renders the skybox in the main menu
*/
private void renderSkybox(int mouseX, int mouseY, float partialTicks) {
this.mc.getFramebuffer().unbindFramebuffer();
GlStateManager.viewport(0, 0, 256, 256);
this.drawPanorama(mouseX, mouseY, partialTicks);
this.rotateAndBlurSkybox(partialTicks);
int i = 3;
CustomPanoramaProperties custompanoramaproperties = CustomPanorama.getCustomPanoramaProperties();
if (custompanoramaproperties != null) {
i = custompanoramaproperties.getBlur3();
}
for (int j = 0; j < i; ++j) {
this.rotateAndBlurSkybox(partialTicks);
this.rotateAndBlurSkybox(partialTicks);
}
this.mc.getFramebuffer().bindFramebuffer(true);
GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
float f2 = 120.0F / (float) (this.width > this.height ? this.width : this.height);
float f = (float) this.height * f2 / 256.0F;
float f1 = (float) this.width * f2 / 256.0F;
int k = this.width;
int l = this.height;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
vertexbuffer.pos(0.0D, (double) l, (double) this.zLevel).tex((double) (0.5F - f), (double) (0.5F + f1))
.color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
vertexbuffer.pos((double) k, (double) l, (double) this.zLevel).tex((double) (0.5F - f), (double) (0.5F - f1))
.color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
vertexbuffer.pos((double) k, 0.0D, (double) this.zLevel).tex((double) (0.5F + f), (double) (0.5F - f1))
.color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
vertexbuffer.pos(0.0D, 0.0D, (double) this.zLevel).tex((double) (0.5F + f), (double) (0.5F + f1))
.color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
tessellator.draw();
}
示例3: bindFramebuffer
import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
public void bindFramebuffer(boolean p_147610_1_)
{
if (OpenGlHelper.isFramebufferEnabled())
{
OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, this.framebufferObject);
if (p_147610_1_)
{
GlStateManager.viewport(0, 0, this.framebufferWidth, this.framebufferHeight);
}
}
}
示例4: renderSkybox
import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
/**
* Renders the skybox in the main menu
*/
private void renderSkybox(int mouseX, int mouseY, float partialTicks)
{
this.mc.getFramebuffer().unbindFramebuffer();
GlStateManager.viewport(0, 0, 256, 256);
this.drawPanorama(mouseX, mouseY, partialTicks);
this.rotateAndBlurSkybox(partialTicks);
this.rotateAndBlurSkybox(partialTicks);
this.rotateAndBlurSkybox(partialTicks);
this.rotateAndBlurSkybox(partialTicks);
this.rotateAndBlurSkybox(partialTicks);
this.rotateAndBlurSkybox(partialTicks);
this.rotateAndBlurSkybox(partialTicks);
this.mc.getFramebuffer().bindFramebuffer(true);
GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
float f = 120.0F / (float)(this.width > this.height ? this.width : this.height);
float f1 = (float)this.height * f / 256.0F;
float f2 = (float)this.width * f / 256.0F;
int i = this.width;
int j = this.height;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
vertexbuffer.pos(0.0D, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
vertexbuffer.pos((double)i, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
vertexbuffer.pos((double)i, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
vertexbuffer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
tessellator.draw();
}
示例5: renderSkybox
import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
/**
* Renders the skybox in the main menu
*/
private void renderSkybox(int p_73971_1_, int p_73971_2_, float p_73971_3_)
{
this.mc.getFramebuffer().unbindFramebuffer();
GlStateManager.viewport(0, 0, 256, 256);
this.drawPanorama(p_73971_1_, p_73971_2_, p_73971_3_);
this.rotateAndBlurSkybox(p_73971_3_);
this.rotateAndBlurSkybox(p_73971_3_);
this.rotateAndBlurSkybox(p_73971_3_);
this.rotateAndBlurSkybox(p_73971_3_);
this.rotateAndBlurSkybox(p_73971_3_);
this.rotateAndBlurSkybox(p_73971_3_);
this.rotateAndBlurSkybox(p_73971_3_);
this.mc.getFramebuffer().bindFramebuffer(true);
GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
float f = this.width > this.height ? 120.0F / (float)this.width : 120.0F / (float)this.height;
float f1 = (float)this.height * f / 256.0F;
float f2 = (float)this.width * f / 256.0F;
int i = this.width;
int j = this.height;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos(0.0D, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
worldrenderer.pos((double)i, (double)j, (double)this.zLevel).tex((double)(0.5F - f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
worldrenderer.pos((double)i, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F - f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
worldrenderer.pos(0.0D, 0.0D, (double)this.zLevel).tex((double)(0.5F + f1), (double)(0.5F + f2)).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex();
tessellator.draw();
}
示例6: renderGuiStart
import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
/**
* Called from asm modified code
* {@link net.minecraft.client.renderer.EntityRenderer#updateCameraAndRender(float, long) updateCameraAndRender}
*/
public static void renderGuiStart() {
if (renderMethod.getResizeGui()) {
Minecraft mc = Minecraft.getMinecraft();
framebuffer.bindFramebuffer(false);
GlStateManager.viewport(0, 0, (int) (mc.displayHeight*renderMethod.getQuality()), (int) (mc.displayHeight*renderMethod.getQuality()));
OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, framebufferTextures[0], 0);
GlStateManager.bindTexture(0);
}
}
示例7: framebufferRenderExt
import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
public void framebufferRenderExt(int p_178038_1_, int p_178038_2_, boolean p_178038_3_)
{
if (OpenGlHelper.isFramebufferEnabled())
{
GlStateManager.colorMask(true, true, true, false);
GlStateManager.disableDepth();
GlStateManager.depthMask(false);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)p_178038_1_, (double)p_178038_2_, 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GlStateManager.viewport(0, 0, p_178038_1_, p_178038_2_);
GlStateManager.enableTexture2D();
GlStateManager.disableLighting();
GlStateManager.disableAlpha();
if (p_178038_3_)
{
GlStateManager.disableBlend();
GlStateManager.enableColorMaterial();
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.bindFramebufferTexture();
float f = (float)p_178038_1_;
float f1 = (float)p_178038_2_;
float f2 = (float)this.framebufferWidth / (float)this.framebufferTextureWidth;
float f3 = (float)this.framebufferHeight / (float)this.framebufferTextureHeight;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos(0.0D, (double)f1, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos((double)f, (double)f1, 0.0D).tex((double)f2, 0.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos((double)f, 0.0D, 0.0D).tex((double)f2, (double)f3).color(255, 255, 255, 255).endVertex();
worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, (double)f3).color(255, 255, 255, 255).endVertex();
tessellator.draw();
this.unbindFramebufferTexture();
GlStateManager.depthMask(true);
GlStateManager.colorMask(true, true, true, true);
}
}
示例8: loadShader
import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
public void loadShader(float p_148042_1_)
{
this.preLoadShader();
this.framebufferIn.unbindFramebuffer();
float f = (float)this.framebufferOut.framebufferTextureWidth;
float f1 = (float)this.framebufferOut.framebufferTextureHeight;
GlStateManager.viewport(0, 0, (int)f, (int)f1);
this.manager.addSamplerTexture("DiffuseSampler", this.framebufferIn);
for (int i = 0; i < this.listAuxFramebuffers.size(); ++i)
{
this.manager.addSamplerTexture((String)this.listAuxNames.get(i), this.listAuxFramebuffers.get(i));
this.manager.getShaderUniformOrDefault("AuxSize" + i).set((float)((Integer)this.listAuxWidths.get(i)).intValue(), (float)((Integer)this.listAuxHeights.get(i)).intValue());
}
this.manager.getShaderUniformOrDefault("ProjMat").set(this.projectionMatrix);
this.manager.getShaderUniformOrDefault("InSize").set((float)this.framebufferIn.framebufferTextureWidth, (float)this.framebufferIn.framebufferTextureHeight);
this.manager.getShaderUniformOrDefault("OutSize").set(f, f1);
this.manager.getShaderUniformOrDefault("Time").set(p_148042_1_);
Minecraft minecraft = Minecraft.getMinecraft();
this.manager.getShaderUniformOrDefault("ScreenSize").set((float)minecraft.displayWidth, (float)minecraft.displayHeight);
this.manager.useShader();
this.framebufferOut.framebufferClear();
this.framebufferOut.bindFramebuffer(false);
GlStateManager.depthMask(false);
GlStateManager.colorMask(true, true, true, true);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.pos(0.0D, (double)f1, 500.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos((double)f, (double)f1, 500.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos((double)f, 0.0D, 500.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos(0.0D, 0.0D, 500.0D).color(255, 255, 255, 255).endVertex();
tessellator.draw();
GlStateManager.depthMask(true);
GlStateManager.colorMask(true, true, true, true);
this.manager.endShader();
this.framebufferOut.unbindFramebuffer();
this.framebufferIn.unbindFramebufferTexture();
for (Object object : this.listAuxFramebuffers)
{
if (object instanceof Framebuffer)
{
((Framebuffer)object).unbindFramebufferTexture();
}
}
}
示例9: framebufferRenderExt
import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
public void framebufferRenderExt(int width, int height, boolean p_178038_3_)
{
if (OpenGlHelper.isFramebufferEnabled())
{
GlStateManager.colorMask(true, true, true, false);
GlStateManager.disableDepth();
GlStateManager.depthMask(false);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)width, (double)height, 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GlStateManager.viewport(0, 0, width, height);
GlStateManager.enableTexture2D();
GlStateManager.disableLighting();
GlStateManager.disableAlpha();
if (p_178038_3_)
{
GlStateManager.disableBlend();
GlStateManager.enableColorMaterial();
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.bindFramebufferTexture();
float f = (float)width;
float f1 = (float)height;
float f2 = (float)this.framebufferWidth / (float)this.framebufferTextureWidth;
float f3 = (float)this.framebufferHeight / (float)this.framebufferTextureHeight;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
vertexbuffer.pos(0.0D, (double)f1, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
vertexbuffer.pos((double)f, (double)f1, 0.0D).tex((double)f2, 0.0D).color(255, 255, 255, 255).endVertex();
vertexbuffer.pos((double)f, 0.0D, 0.0D).tex((double)f2, (double)f3).color(255, 255, 255, 255).endVertex();
vertexbuffer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, (double)f3).color(255, 255, 255, 255).endVertex();
tessellator.draw();
this.unbindFramebufferTexture();
GlStateManager.depthMask(true);
GlStateManager.colorMask(true, true, true, true);
}
}
示例10: func_152922_k
import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的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;
}
}
}
示例11: renderWorld
import net.minecraft.client.renderer.GlStateManager; //导入方法依赖的package包/类
/**
* Render the world.
* Called between {@link net.minecraft.client.renderer.EntityRenderer#renderWorld(float, long) renderWorld}
* and {@link net.minecraft.client.renderer.EntityRenderer#renderWorldPass(int, float, long) renderWorldPass}
*/
public void renderWorld(EntityRenderer er, Minecraft mc, Framebuffer framebuffer, Shader shader,
int[] framebufferTextures, float partialTicks, long finishTimeNano, int width, int height, float sizeIncrease) {
//save the players state
player = mc.getRenderViewEntity();
yaw = player.rotationYaw;
pitch = player.rotationPitch;
prevYaw = player.prevRotationYaw;
prevPitch = player.prevRotationPitch;
//clear the primary framebuffer
mc.getFramebuffer().framebufferClear();
//clear the secondary framebuffer
framebuffer.framebufferClear();
//bind the secondary framebuffer
framebuffer.bindFramebuffer(false);
//displayWidth and displayHeight are called during world rendering
//set them to the secondary framebuffer dimensions
mc.displayWidth = (int)(height*sizeIncrease);
mc.displayHeight = (int)(height*sizeIncrease); //Must be square
RenderUtil.partialWidth = mc.displayWidth; //TODO is this even needed?
RenderUtil.partialHeight = mc.displayHeight; //TODO remove
RenderUtil.render360 = true;
Globe globe = globes[globeIndex];
for (int i=0; i<globe.getCount(); i++) {
// set camera/player rotation state (read by hooks at the correct moment)
coordFrame = globe.getCoordFrame(i);
playerFov = globe.getFov(i);
// the forward vector is the opposite direction of the z-axis
float x = -coordFrame.get(2);
float y = -coordFrame.get(6);
float z = -coordFrame.get(10);
// calculate the delta yaw/pitch to point the player
float lon = (float)Math.atan2(x, -z);
float lat = (float)Math.atan2(y, Math.sqrt(x*x+z*z));
playerDeltaYaw = lon;
playerDeltaPitch = lat;
// render to texture
OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, framebufferTextures[i], 0);
GlStateManager.bindTexture(0);
er.renderWorldPass(2, partialTicks, finishTimeNano);
// reset player view
player.rotationYaw = yaw;
player.rotationPitch = pitch;
player.prevRotationYaw = prevYaw;
player.prevRotationPitch = prevPitch;
}
//reset displayWidth and displayHeight to the primary framebuffer dimensions
mc.displayWidth = width;
mc.displayHeight = height;
//reset viewport to full screen
GlStateManager.viewport(0, 0, width, height);
//bind primary framebuffer
mc.getFramebuffer().bindFramebuffer(false);
if (!getResizeGui() || mc.gameSettings.hideGUI) {
GL20.glUseProgram(shader.getShaderProgram());
int cursorUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "drawCursor");
GL20.glUniform1i(cursorUniform, 0);
runShader(mc, shader, framebufferTextures);
}
}