private void uploadFloatMatrix() { switch (this.uniformType) { case 8: OpenGlHelper.glUniformMatrix2(this.uniformLocation, true, this.uniformFloatBuffer); break; case 9: OpenGlHelper.glUniformMatrix3(this.uniformLocation, true, this.uniformFloatBuffer); break; case 10: OpenGlHelper.glUniformMatrix4(this.uniformLocation, true, this.uniformFloatBuffer); } }
@Override public void doRenderLayer(EntityCreeperween entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { this.renderEntity.bindTexture(CREEPERWEEN_EYES); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); GlStateManager.depthMask(true); int i = 61680; int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.renderEntity.getMainModel().render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); i = entity.getBrightnessForRender(); j = i % 65536; k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); this.renderEntity.setLightmap(entity); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); }
private void uploadInt() { switch (this.uniformType) { case 0: OpenGlHelper.glUniform1(this.uniformLocation, this.uniformIntBuffer); break; case 1: OpenGlHelper.glUniform2(this.uniformLocation, this.uniformIntBuffer); break; case 2: OpenGlHelper.glUniform3(this.uniformLocation, this.uniformIntBuffer); break; case 3: OpenGlHelper.glUniform4(this.uniformLocation, this.uniformIntBuffer); break; default: logger.warn("Uniform.upload called, but count value (" + this.uniformCount + ") is " + " not in the range of 1 to 4. Ignoring."); } }
public RenderChunk(World p_i47120_1_, RenderGlobal p_i47120_2_, int p_i47120_3_) { for (int i = 0; i < this.mapEnumFacing.length; ++i) { this.mapEnumFacing[i] = new BlockPos.MutableBlockPos(); } this.world = p_i47120_1_; this.renderGlobal = p_i47120_2_; this.index = p_i47120_3_; if (OpenGlHelper.useVbo()) { for (int j = 0; j < BlockRenderLayer.values().length; ++j) { this.vertexBuffers[j] = new VertexBuffer(DefaultVertexFormats.BLOCK); } } }
/** * Renders the particle */ public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { float f = ((float)this.age + partialTicks) / (float)this.maxAge; f = f * f; double d0 = this.item.posX; double d1 = this.item.posY; double d2 = this.item.posZ; double d3 = this.target.lastTickPosX + (this.target.posX - this.target.lastTickPosX) * (double)partialTicks; double d4 = this.target.lastTickPosY + (this.target.posY - this.target.lastTickPosY) * (double)partialTicks + (double)this.yOffset; double d5 = this.target.lastTickPosZ + (this.target.posZ - this.target.lastTickPosZ) * (double)partialTicks; double d6 = d0 + (d3 - d0) * (double)f; double d7 = d1 + (d4 - d1) * (double)f; double d8 = d2 + (d5 - d2) * (double)f; int i = this.getBrightnessForRender(partialTicks); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); d6 = d6 - interpPosX; d7 = d7 - interpPosY; d8 = d8 - interpPosZ; GlStateManager.enableLighting(); this.renderManager.doRenderEntity(this.item, d6, d7, d8, this.item.rotationYaw, partialTicks, false); }
public void renderWitherSkull(Entity entityIn, float partialTicks) { double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; Render<Entity> render = this.<Entity>getEntityRenderObject(entityIn); if (render != null && this.renderEngine != null) { int i = entityIn.getBrightnessForRender(partialTicks); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); render.renderName(entityIn, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ); } }
public void createBindFramebuffer(int width, int height) { if (!OpenGlHelper.isFramebufferEnabled()) { this.framebufferWidth = width; this.framebufferHeight = height; } else { GlStateManager.enableDepth(); if (this.framebufferObject >= 0) { this.deleteFramebuffer(); } this.createFramebuffer(width, height); this.checkFramebufferComplete(); OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, 0); } }
public void doRenderLayer(EntityIronGolem entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { if (entitylivingbaseIn.getHoldRoseTick() != 0) { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.enableRescaleNormal(); GlStateManager.pushMatrix(); GlStateManager.rotate(5.0F + 180.0F * ((ModelIronGolem)this.ironGolemRenderer.getMainModel()).ironGolemRightArm.rotateAngleX / (float)Math.PI, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.translate(-0.9375F, -0.625F, -0.9375F); float f = 0.5F; GlStateManager.scale(0.5F, -0.5F, 0.5F); int i = entitylivingbaseIn.getBrightnessForRender(partialTicks); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.ironGolemRenderer.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); blockrendererdispatcher.renderBlockBrightness(Blocks.RED_FLOWER.getDefaultState(), 1.0F); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); } }
@Override public void doRenderLayer(EntityEvolvedEnderman entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { endermanRenderer.bindTexture(RES_ENDERMAN_EYES); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); GlStateManager.disableLighting(); GlStateManager.depthMask(!entitylivingbaseIn.isInvisible()); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680.0F, 0.0F); GlStateManager.enableLighting(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); endermanRenderer.getMainModel().render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); endermanRenderer.setLightmap(entitylivingbaseIn); GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); }
public void renderEntityStatic(Entity entityIn, float partialTicks, boolean p_188388_3_) { if (entityIn.ticksExisted == 0) { entityIn.lastTickPosX = entityIn.posX; entityIn.lastTickPosY = entityIn.posY; entityIn.lastTickPosZ = entityIn.posZ; } double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; float f = entityIn.prevRotationYaw + (entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks; int i = entityIn.getBrightnessForRender(partialTicks); if (entityIn.isBurning()) { i = 15728880; } int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.doRenderEntity(entityIn, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ, f, partialTicks, p_188388_3_); }
public RenderChunk(World worldIn, RenderGlobal renderGlobalIn, BlockPos blockPosIn, int indexIn) { this.world = worldIn; this.renderGlobal = renderGlobalIn; this.index = indexIn; if (!blockPosIn.equals(this.getPosition())) { this.setPosition(blockPosIn); } if (OpenGlHelper.useVbo()) { for (int i = 0; i < EnumWorldBlockLayer.values().length; ++i) { this.vertexBuffers[i] = new VertexBuffer(DefaultVertexFormats.BLOCK); } } }
@Override public void renderStack(double x, double y, double z, float partialTicks) { float tick = RenderHelper.getRenderWorldTime(partialTicks); final float prevU = OpenGlHelper.lastBrightnessX; final float prevV = OpenGlHelper.lastBrightnessY; ItemStack stack = SpecialModelRenderer.getTempItemRenderer(); if(!stack.isEmpty()) { GlStateManager.pushMatrix(); GLHelper.lightMap(255F, 255F); GlStateManager.translate(x + 0.5D, y + 0.38D, z + 0.5D); GlStateManager.rotate(partialTicks + tick * 0.5F % 360F, 0F, 1F, 0F); RenderHelper.renderItemStack(stack); GlStateManager.popMatrix(); } GLHelper.disableDepth(); renderModel(tick, x, y, z); GLHelper.enableDepth(); GLHelper.lightMap(prevU, prevV); }
public boolean renderEntityStatic(Entity entity, float partialTicks, boolean p_147936_3_) { if (entity.ticksExisted == 0) { entity.lastTickPosX = entity.posX; entity.lastTickPosY = entity.posY; entity.lastTickPosZ = entity.posZ; } double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; float f = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks; int i = entity.getBrightnessForRender(partialTicks); if (entity.isBurning()) { i = 15728880; } int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); return this.doRenderEntity(entity, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ, f, partialTicks, p_147936_3_); }
public void doRenderLayer(EntityDragon entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { this.dragonRenderer.bindTexture(TEXTURE); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(1, 1); GlStateManager.disableLighting(); GlStateManager.depthFunc(514); int i = 61680; int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); GlStateManager.enableLighting(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.dragonRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); this.dragonRenderer.func_177105_a(entitylivingbaseIn, partialTicks); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.depthFunc(515); }
public void doRenderLayer(EntityEnderman entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { this.endermanRenderer.bindTexture(field_177203_a); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(1, 1); GlStateManager.disableLighting(); GlStateManager.depthMask(!entitylivingbaseIn.isInvisible()); int i = 61680; int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); GlStateManager.enableLighting(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.endermanRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); this.endermanRenderer.func_177105_a(entitylivingbaseIn, partialTicks); GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); }
public void doRenderLayer(EntityIronGolem entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { if (entitylivingbaseIn.getHoldRoseTick() != 0) { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.enableRescaleNormal(); GlStateManager.pushMatrix(); GlStateManager.rotate(5.0F + 180.0F * ((ModelIronGolem)this.ironGolemRenderer.getMainModel()).ironGolemRightArm.rotateAngleX / (float)Math.PI, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.translate(-0.9375F, -0.625F, -0.9375F); float f = 0.5F; GlStateManager.scale(f, -f, f); int i = entitylivingbaseIn.getBrightnessForRender(partialTicks); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.ironGolemRenderer.bindTexture(TextureMap.locationBlocksTexture); blockrendererdispatcher.renderBlockBrightness(Blocks.red_flower.getDefaultState(), 1.0F); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); } }
@Override public void onDisable() { if(!OpenGlHelper.shadersSupported) { wurst.events.remove(UpdateListener.class, this); WPlayer.removePotionEffect(WPotionEffects.NAUSEA); return; } if(mc.entityRenderer.theShaderGroup != null) { mc.entityRenderer.theShaderGroup.deleteShaderGroup(); mc.entityRenderer.theShaderGroup = null; } }
public void renderWitherSkull(Entity entityIn, float partialTicks) { double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; Render render = this.getEntityRenderObject(entityIn); if (render != null && this.renderEngine != null) { int i = entityIn.getBrightnessForRender(partialTicks); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); render.renderName(entityIn, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ); } }
public void doRenderLayer(EntityDragon entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { this.dragonRenderer.bindTexture(TEXTURE); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); GlStateManager.disableLighting(); GlStateManager.depthFunc(514); int i = 61680; int j = 61680; int k = 0; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680.0F, 0.0F); GlStateManager.enableLighting(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.dragonRenderer.getMainModel().render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); this.dragonRenderer.setLightmap(entitylivingbaseIn, partialTicks); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.depthFunc(515); }
public static void enableLighting() { GL11.glDisable((int)3042); GL11.glEnable((int)3553); GL11.glDisable((int)2848); GL11.glDisable((int)3042); OpenGlHelper.setActiveTexture((int)OpenGlHelper.lightmapTexUnit); GL11.glMatrixMode((int)5890); GL11.glLoadIdentity(); float var3 = 0.0039063f; GL11.glScalef((float)var3, (float)var3, (float)var3); GL11.glTranslatef((float)8.0f, (float)8.0f, (float)8.0f); GL11.glMatrixMode((int)5888); GL11.glTexParameteri((int)3553, (int)10241, (int)9729); GL11.glTexParameteri((int)3553, (int)10240, (int)9729); GL11.glTexParameteri((int)3553, (int)10242, (int)10496); GL11.glTexParameteri((int)3553, (int)10243, (int)10496); GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f); OpenGlHelper.setActiveTexture((int)OpenGlHelper.defaultTexUnit); }
public void renderTileEntity(TileEntity tileentityIn, float partialTicks, int destroyStage) { if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) { RenderHelper.enableStandardItemLighting(); boolean flag = true; if (Reflector.ForgeTileEntity_hasFastRenderer.exists()) { flag = !this.drawingBatch || !Reflector.callBoolean(tileentityIn, Reflector.ForgeTileEntity_hasFastRenderer, new Object[0]); } if (flag) { int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j, (float)k); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } BlockPos blockpos = tileentityIn.getPos(); this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); } }
/** * Renders the particle */ public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) { float f = ((float)this.age + partialTicks) / (float)this.maxAge; f = f * f; double d0 = this.field_174840_a.posX; double d1 = this.field_174840_a.posY; double d2 = this.field_174840_a.posZ; double d3 = this.field_174843_ax.lastTickPosX + (this.field_174843_ax.posX - this.field_174843_ax.lastTickPosX) * (double)partialTicks; double d4 = this.field_174843_ax.lastTickPosY + (this.field_174843_ax.posY - this.field_174843_ax.lastTickPosY) * (double)partialTicks + (double)this.field_174841_aA; double d5 = this.field_174843_ax.lastTickPosZ + (this.field_174843_ax.posZ - this.field_174843_ax.lastTickPosZ) * (double)partialTicks; double d6 = d0 + (d3 - d0) * (double)f; double d7 = d1 + (d4 - d1) * (double)f; double d8 = d2 + (d5 - d2) * (double)f; int i = this.getBrightnessForRender(partialTicks); int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); d6 = d6 - interpPosX; d7 = d7 - interpPosY; d8 = d8 - interpPosZ; this.field_174842_aB.renderEntityWithPosYaw(this.field_174840_a, (double)((float)d6), (double)((float)d7), (double)((float)d8), this.field_174840_a.rotationYaw, partialTicks); }
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); } } }
private static void setLightmap() { AbstractClientPlayer abstractclientplayer = Minecraft.getMinecraft().player; int i = Minecraft.getMinecraft().world.getCombinedLight(new BlockPos(abstractclientplayer.posX, abstractclientplayer.posY + (double) abstractclientplayer.getEyeHeight(), abstractclientplayer.posZ), 0); float f = (float) (i & 65535); float f1 = (float) (i >> 16); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1); }
public int loadProgram(String vsh, String fsh) { if (OpenGlHelper.shadersSupported) { int vertexShader = createShader(vsh, OpenGlHelper.GL_VERTEX_SHADER); int fragmentShader = createShader(fsh, OpenGlHelper.GL_FRAGMENT_SHADER); int program = OpenGlHelper.glCreateProgram(); OpenGlHelper.glAttachShader(program, vertexShader); OpenGlHelper.glAttachShader(program, fragmentShader); OpenGlHelper.glLinkProgram(program); return program; } return 0; }
public void checkFramebufferComplete() { int i = OpenGlHelper.glCheckFramebufferStatus(OpenGlHelper.GL_FRAMEBUFFER); if (i != OpenGlHelper.GL_FRAMEBUFFER_COMPLETE) { if (i == OpenGlHelper.GL_FB_INCOMPLETE_ATTACHMENT) { throw new RuntimeException("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"); } else if (i == OpenGlHelper.GL_FB_INCOMPLETE_MISS_ATTACH) { throw new RuntimeException("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"); } else if (i == OpenGlHelper.GL_FB_INCOMPLETE_DRAW_BUFFER) { throw new RuntimeException("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER"); } else if (i == OpenGlHelper.GL_FB_INCOMPLETE_READ_BUFFER) { throw new RuntimeException("GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER"); } else { throw new RuntimeException("glCheckFramebufferStatus returned unknown status:" + i); } } }
public void createFramebuffer(int width, int height) { this.framebufferWidth = width; this.framebufferHeight = height; this.framebufferTextureWidth = width; this.framebufferTextureHeight = height; if (!OpenGlHelper.isFramebufferEnabled()) { this.framebufferClear(); } else { this.framebufferObject = OpenGlHelper.glGenFramebuffers(); this.framebufferTexture = TextureUtil.glGenTextures(); if (this.useDepth) { this.depthBuffer = OpenGlHelper.glGenRenderbuffers(); } this.setFramebufferFilter(9728); GlStateManager.bindTexture(this.framebufferTexture); GlStateManager.glTexImage2D(3553, 0, 32856, this.framebufferTextureWidth, this.framebufferTextureHeight, 0, 6408, 5121, (IntBuffer)null); OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, this.framebufferObject); OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, this.framebufferTexture, 0); if (this.useDepth) { OpenGlHelper.glBindRenderbuffer(OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); OpenGlHelper.glRenderbufferStorage(OpenGlHelper.GL_RENDERBUFFER, 33190, this.framebufferTextureWidth, this.framebufferTextureHeight); OpenGlHelper.glFramebufferRenderbuffer(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_DEPTH_ATTACHMENT, OpenGlHelper.GL_RENDERBUFFER, this.depthBuffer); } this.framebufferClear(); this.unbindFramebufferTexture(); } }
private void displayString(String message) { this.currentlyDisplayedText = message; if (!this.mc.running) { if (!this.loadingSuccess) { throw new MinecraftError(); } } else { GlStateManager.clear(256); GlStateManager.matrixMode(5889); GlStateManager.loadIdentity(); if (OpenGlHelper.isFramebufferEnabled()) { int i = this.scaledResolution.getScaleFactor(); GlStateManager.ortho(0.0D, (double)(this.scaledResolution.getScaledWidth() * i), (double)(this.scaledResolution.getScaledHeight() * i), 0.0D, 100.0D, 300.0D); } else { ScaledResolution scaledresolution = new ScaledResolution(this.mc); GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); } GlStateManager.matrixMode(5888); GlStateManager.loadIdentity(); GlStateManager.translate(0.0F, 0.0F, -200.0F); } }
public void doRenderLayer(EntitySpider entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) { this.spiderRenderer.bindTexture(SPIDER_EYES); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(1, 1); if (entitylivingbaseIn.isInvisible()) { GlStateManager.depthMask(false); } else { GlStateManager.depthMask(true); } int i = 61680; int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.spiderRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); i = entitylivingbaseIn.getBrightnessForRender(partialTicks); j = i % 65536; k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F); this.spiderRenderer.func_177105_a(entitylivingbaseIn, partialTicks); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); }
private void displayString(String message) { this.currentlyDisplayedText = message; if (!this.mc.running) { if (!this.field_73724_e) { throw new MinecraftError(); } } else { GlStateManager.clear(256); GlStateManager.matrixMode(5889); GlStateManager.loadIdentity(); if (OpenGlHelper.isFramebufferEnabled()) { int i = this.scaledResolution.getScaleFactor(); GlStateManager.ortho(0.0D, (double)(this.scaledResolution.getScaledWidth() * i), (double)(this.scaledResolution.getScaledHeight() * i), 0.0D, 100.0D, 300.0D); } else { ScaledResolution scaledresolution = new ScaledResolution(this.mc); GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); } GlStateManager.matrixMode(5888); GlStateManager.loadIdentity(); GlStateManager.translate(0.0F, 0.0F, -200.0F); } }
public void linkProgram(ShaderManager manager) throws IOException { manager.getFragmentShaderLoader().attachShader(manager); manager.getVertexShaderLoader().attachShader(manager); OpenGlHelper.glLinkProgram(manager.getProgram()); int i = OpenGlHelper.glGetProgrami(manager.getProgram(), OpenGlHelper.GL_LINK_STATUS); if (i == 0) { logger.warn("Error encountered when linking program containing VS " + manager.getVertexShaderLoader().getShaderFilename() + " and FS " + manager.getFragmentShaderLoader().getShaderFilename() + ". Log output:"); logger.warn(OpenGlHelper.glGetProgramInfoLog(manager.getProgram(), 32768)); } }
public void setFramebufferFilter(int framebufferFilterIn) { if (OpenGlHelper.isFramebufferEnabled()) { this.framebufferFilter = framebufferFilterIn; GlStateManager.bindTexture(this.framebufferTexture); GlStateManager.glTexParameteri(3553, 10241, framebufferFilterIn); GlStateManager.glTexParameteri(3553, 10240, framebufferFilterIn); GlStateManager.glTexParameteri(3553, 10242, 10496); GlStateManager.glTexParameteri(3553, 10243, 10496); GlStateManager.bindTexture(0); } }
public void deleteShader(ShaderManager manager) { --this.shaderAttachCount; if (this.shaderAttachCount <= 0) { OpenGlHelper.glDeleteShader(this.shader); this.shaderType.getLoadedShaders().remove(this.shaderFilename); } }