/** * Render a single character with the default.png font at current (posX,posY) location... */ private float renderDefaultChar(int p_78266_1_, boolean p_78266_2_) { int i = p_78266_1_ % 16 * 8; int j = p_78266_1_ / 16 * 8; int k = p_78266_2_ ? 1 : 0; this.bindTexture(this.locationFontTexture); float f = this.charWidth[p_78266_1_]; float f1 = 7.99F; GL11.glBegin(GL11.GL_TRIANGLE_STRIP); GL11.glTexCoord2f((float)i / 128.0F, (float)j / 128.0F); GL11.glVertex3f(this.posX + (float)k, this.posY, 0.0F); GL11.glTexCoord2f((float)i / 128.0F, ((float)j + 7.99F) / 128.0F); GL11.glVertex3f(this.posX - (float)k, this.posY + 7.99F, 0.0F); GL11.glTexCoord2f(((float)i + f1 - 1.0F) / 128.0F, (float)j / 128.0F); GL11.glVertex3f(this.posX + f1 - 1.0F + (float)k, this.posY, 0.0F); GL11.glTexCoord2f(((float)i + f1 - 1.0F) / 128.0F, ((float)j + 7.99F) / 128.0F); GL11.glVertex3f(this.posX + f1 - 1.0F - (float)k, this.posY + 7.99F, 0.0F); GL11.glEnd(); return f; }
@Override public void render(SemiBlockCropSupport semiBlock, float partialTick) { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(Textures.MODEL_HEAT_FRAME); double brightness = 0.2; GL11.glColor4d(brightness, brightness, brightness, 1); AxisAlignedBB aabb = new AxisAlignedBB(3 / 16D, -6 / 16D, 3 / 16D, 13 / 16D, 17 / 16D, 13 / 16D); GL11.glTranslated(aabb.minX, aabb.minY, aabb.minZ); GL11.glScaled(aabb.maxX - aabb.minX, aabb.maxY - aabb.minY, aabb.maxZ - aabb.minZ); GL11.glTranslated(0.5, -0.5, 0.5); model.render(null, 0, 0, 0, 0, 0, 1 / 16F); GL11.glPopMatrix(); GL11.glColor4d(1, 1, 1, 1); }
@SideOnly(Side.CLIENT) private static final void renderTieBottom(float width){ GL11.glTexCoord2f(tieTopMinU, tieTopMinV); GL11.glNormal3f(0, 1, 0); GL11.glVertex3f(width/2, 0, length/2); GL11.glTexCoord2f(tieTopMaxU, tieTopMinV); GL11.glNormal3f(0, 1, 0); GL11.glVertex3f(-width/2, 0, length/2); GL11.glTexCoord2f(tieTopMaxU, tieTopMaxV); GL11.glNormal3f(0, 1, 0); GL11.glVertex3f(-width/2, 0, -length/2); GL11.glTexCoord2f(tieTopMinU, tieTopMaxV); GL11.glNormal3f(0, 1, 0); GL11.glVertex3f(width/2, 0, -length/2); }
public static void emptyBlockESPBox(BlockPos blockPos) { double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX; double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY; double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ; GL11.glBlendFunc(770, 771); GL11.glEnable(GL_BLEND); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glColor4d(0, 0, 0, 0.5F); drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0)); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDisable(GL_BLEND); }
@Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { if (content.bg != null) { mc.getTextureManager().bindTexture(content.bg); int x = (width - xSize) / 2; int y = (height - ySize) / 2; drawTexturedModalRect(x, y, content.bgTexX, content.bgTexY, xSize, ySize); GL11.glPushMatrix(); GL11.glTranslatef(x, y, 0f); for (ProgressBar bar : content.progressBars) { bar.draw(progressBarSource); } GL11.glPopMatrix(); } }
@Override public void draw() { super.draw(); TextureManager render = mc.renderEngine; render.bindTexture(resource); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.color(1F, 1F, 1F, 1F); int k = (gui.width - gui.WIDTH) / 2; gui.drawTexturedModalRect(k + 5, 5, 0, 0, gui.WIDTH, gui.HEIGHT); gui.drawCenteredString(mc.fontRendererObj, text, drawX + 60, drawY + 150, Color.gray.getRGB()); GlStateManager.disableBlend(); }
@Override protected void onWorldDraw(float delta, float x, float y, float z) { float mx, my, mz; if (!safeShow) return; if (--safeUpdate < 0) { safeUpdate = 13; reCheckSafe(fix(x), fix(y), fix(z)); } if (safeGhost) GL11.glDisable(GL11.GL_DEPTH_TEST); else GL11.glEnable( GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_FOG); GL11.glBegin(GL11.GL_LINES); for (int i = 0; i < safeCur; ++i) { Vec3i pos = safePoses[i]; Color color = safeMarks[i]; GL11.glColor3ub(color.rb, color.gb, color.bb); mx = pos.getX() - x; my = pos.getY() - y; mz = pos.getZ() - z; GL11.glVertex3f(mx+0.9f,my+0.01f,mz+0.9f); GL11.glVertex3f(mx+0.1f,my+0.01f,mz+0.1f); GL11.glVertex3f(mx+0.9f,my+0.01f,mz+0.1f); GL11.glVertex3f(mx+0.1f,my+0.01f,mz+0.9f); } GL11.glEnd(); }
@Override protected void onControllerDrag() { Part part = selectedPart; if(part instanceof PartObj || part instanceof PartRotation) super.onControllerDrag(); else { GL11.glPushMatrix(); if(part instanceof PartEntityPos) GL11.glTranslated(-entityToRender.posX, -entityToRender.posY, -entityToRender.posZ); int i = translationAxisPlane == 0 ? 2 : translationAxisPlane - 1; translationGuidePoint = getMouseVectorInPlane(i); processAxisDrag(); GL11.glPopMatrix(); } }
public VBO updateData(IntBuffer buffer, long offset) { if (this.type != GL11.GL_UNSIGNED_INT) { throw new IllegalArgumentException("Cannot store mismatching type in buffer!"); } if (offset + buffer.limit() > this.length) { int usage = GL15.glGetBufferParameteri(this.target, GL15.GL_BUFFER_USAGE); this.putData(buffer, this.normalized, usage); } GL15.glBindBuffer(this.target, this.handle); GL15.glBufferSubData(this.target, offset, buffer); return this; }
@Override public void render() { FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getTexture()); int width = getWidth() + (getParameters() != null && getParameters().length > 0 ? 10 : 0); int height = getHeight() + (hasStepOutput() ? 10 : 0); Pair<Double, Double> maxUV = getMaxUV(); double u = maxUV.getLeft(); double v = maxUV.getRight(); BufferBuilder wr = Tessellator.getInstance().getBuffer(); wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); wr.pos(0, 0, 0).tex(0, 0).endVertex(); wr.pos(0, height, 0).tex(0, v).endVertex(); wr.pos(width, height, 0).tex(u, v).endVertex(); wr.pos(width, 0, 0).tex(u, 0).endVertex(); Tessellator.getInstance().draw(); }
@Override protected void renderDynamic(float scale, float partialTicks) { shape1.render(scale); shape2.render(scale); float pressure = 0f; float dangerPressure = 5f; float critPressure = 7f; if (gaugeModule != null && gaugeModule.getTube() instanceof TileEntityPneumaticBase) { TileEntityPneumaticBase base = (TileEntityPneumaticBase) gaugeModule.getTube(); pressure = base.getPressure(); critPressure = base.criticalPressure; dangerPressure = base.dangerPressure; } GL11.glTranslated(0, 1, 0.378); double widgetScale = 0.007D; GL11.glScaled(widgetScale, widgetScale, widgetScale); GL11.glRotated(180, 0, 1, 0); GL11.glDisable(GL11.GL_LIGHTING); GuiUtils.drawPressureGauge(FMLClientHandler.instance().getClient().fontRenderer, -1, critPressure, dangerPressure, -1, pressure, 0, 0, 0); GL11.glEnable(GL11.GL_LIGHTING); }
private void renderPumpkinBlur(int i, int j) { GL11.glDisable(2929 /*GL_DEPTH_TEST*/); GL11.glDepthMask(false); GL11.glBlendFunc(770, 771); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(3008 /*GL_ALPHA_TEST*/); GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("%blur%/misc/pumpkinblur.png")); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, j, -90D, 0.0D, 1.0D); tessellator.addVertexWithUV(i, j, -90D, 1.0D, 1.0D); tessellator.addVertexWithUV(i, 0.0D, -90D, 1.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, -90D, 0.0D, 0.0D); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(2929 /*GL_DEPTH_TEST*/); GL11.glEnable(3008 /*GL_ALPHA_TEST*/); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
/** * @see org.newdawn.slick.Graphics#disable() */ protected void disable() { // Bind the texture after rendering. GL11.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID()); GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, image.getTexture().getTextureWidth(), image.getTexture().getTextureHeight(), 0); try { Display.makeCurrent(); } catch (LWJGLException e) { Log.error(e); } SlickCallable.leaveSafeBlock(); }
public static void renderGhostModel(IBakedModel model, BlockPos position, Color color, boolean noDepth, float partialTicks) { GlStateManager.enableBlend(); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_DST_COLOR); BufferBuilder vb; if(noDepth) { GlStateManager.depthFunc(519); vb = prepRenderBlockDepth(partialTicks, true); } else vb = prepRender(partialTicks, true); vb.begin(7, DefaultVertexFormats.BLOCK); World world = Minecraft.getMinecraft().world; BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); dispatcher.getBlockModelRenderer().renderModel(world, model, Minecraft.getMinecraft().world.getBlockState(position), position.add(0, noDepth ? 500 : 0, 0), vb, false); for(int i = 0; i < vb.getVertexCount(); i++) vb.putColorMultiplier(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, i); vb.color(1, 1, 1, 0.1f); postRender(); GlStateManager.depthFunc(515); GlStateManager.disableBlend(); }
public static void renderBillboardQuadWithRotation(float rot, double scale) { GlStateManager.pushMatrix(); rotateToPlayer(); GlStateManager.rotate(rot, 0, 0, 1); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); buffer.pos(-scale, -scale, 0).tex(0, 0).endVertex(); buffer.pos(-scale, +scale, 0).tex(0, 1).endVertex(); ; buffer.pos(+scale, +scale, 0).tex(1, 1).endVertex(); ; buffer.pos(+scale, -scale, 0).tex(1, 0).endVertex(); ; tessellator.draw(); GlStateManager.popMatrix(); }
/** * Initialise the PBuffer that will be used to render to * * @throws SlickException */ private void init() throws SlickException { try { Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter()); final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0); pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null); // Initialise state of the pbuffer context. pbuffer.makeCurrent(); initGL(); GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID()); pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER); image.draw(0,0); image.setTexture(tex); Display.makeCurrent(); } catch (Exception e) { Log.error(e); throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?"); } }
public void drawScreen(int i, int j, float f) { drawDefaultBackground(); Tessellator tessellator = Tessellator.instance; char c = '\u0112'; int k = width / 2 - c / 2; byte byte0 = 30; GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/title/mclogo.png")); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); drawTexturedModalRect(k + 0, byte0 + 0, 0, 0, 155, 44); drawTexturedModalRect(k + 155, byte0 + 0, 0, 45, 155, 44); tessellator.setColorOpaque_I(0xffffff); GL11.glPushMatrix(); GL11.glTranslatef(width / 2 + 90, 70F, 0.0F); GL11.glRotatef(-20F, 0.0F, 0.0F, 1.0F); float f1 = 1.8F - MathHelper.abs(MathHelper.sin(((float)(System.currentTimeMillis() % 1000L) / 1000F) * 3.141593F * 2.0F) * 0.1F); f1 = (f1 * 100F) / (float)(fontRenderer.getStringWidth(splashText) + 32); GL11.glScalef(f1, f1, f1); drawCenteredString(fontRenderer, splashText, 0, -8, 0xffff00); GL11.glPopMatrix(); drawString(fontRenderer, "Minecraft Beta 1.7.3", 2, 2, 0x505050); drawString(fontRenderer, "BetaExpansion "+mod_BetaExpansion.version, 2, height-10, 0x505050); String s = "Copyright Mojang AB. Do not distribute."; drawString(fontRenderer, s, width - fontRenderer.getStringWidth(s) - 2, height - 10, 0xffffff); super.drawScreen(i, j, f); }
/** * Renders the world to the water framebuffer. * @param worldCamera * @param world */ public void preRender(final PerspectiveCamera camera, final World world) { GL11.glEnable(GL30.GL_CLIP_DISTANCE0); framebuffer.bind(); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // Render to reflection texture. float verticalDistance = camera.getPosition().y - WATER_HEIGHT; camera.getPosition().y -= verticalDistance * 2; camera.invertPitch(); camera.update(); world.renderWithoutWater(camera, true); camera.invertPitch(); camera.getPosition().y += verticalDistance * 2; camera.update(); FrameBuffer.unbind(); GL11.glDisable(GL30.GL_CLIP_DISTANCE0); }
public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_) { deleteTexture(p_180600_0_); bindTexture(p_180600_0_); if (p_180600_1_ >= 0) { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)p_180600_1_); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F); } for (int i = 0; i <= p_180600_1_; ++i) { GL11.glTexImage2D(GL11.GL_TEXTURE_2D, i, GL11.GL_RGBA, p_180600_2_ >> i, p_180600_3_ >> i, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)((IntBuffer)null)); } }
public static void genCompositeMipmap() { if (hasGlGenMipmap) { for (int i = 0; i < usedColorBuffers; ++i) { if ((activeCompositeMipmapSetting & 1 << i) != 0) { GlStateManager.setActiveTexture(33984 + colorTextureTextureImageUnit[i]); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR); GL30.glGenerateMipmap(3553); } } GlStateManager.setActiveTexture(33984); } }
public static Texture loadTexture(String textureFile) { try { // InputStream in = TextureLoader.class.getResourceAsStream("/" + textureFile); InputStream in = Util.loadInternal(textureFile); BufferedImage image = ImageIO.read(in); int[] pixels = new int[image.getWidth() * image.getHeight()]; image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth()); ByteBuffer buffer = ByteBuffer.allocateDirect(image.getWidth() * image.getHeight() * 4); for(int h = 0; h < image.getHeight(); h++) { for(int w = 0; w < image.getWidth(); w++) { int pixel = pixels[h * image.getWidth() + w]; buffer.put((byte) ((pixel >> 16) & 0xFF)); buffer.put((byte) ((pixel >> 8) & 0xFF)); buffer.put((byte) (pixel & 0xFF)); buffer.put((byte) ((pixel >> 24) & 0xFF)); } } buffer.flip(); in.close(); int textureID = GL11.glGenTextures(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buffer); GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_NEAREST); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_MAX_TEXTURE_LOD_BIAS, -1); GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); return new Texture(textureID, image.getWidth(), image.getHeight()); } catch (Exception e) { e.printStackTrace(); return null; } }
@Override public void render(float alpha) { Vec2 pos = getPos(); Vec2 radius = getRadius(); if (getValue()) { GL11.glColor4f(1.0f, 1.0f, 1.0f, alpha*0.5f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(pos.x - radius.x, pos.y - radius.y); GL11.glVertex2f(pos.x - radius.x, pos.y + radius.y); GL11.glVertex2f(pos.x + radius.x, pos.y + radius.y); GL11.glVertex2f(pos.x + radius.x, pos.y - radius.y); GL11.glEnd(); } GL11.glLineWidth(1.0f); float color = Main.instance().getFocus() == this ? 0.75f : 1.0f; GL11.glColor4f(color, color, 1.0f, alpha); font.render(text, pos, size, Alignment.C); GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex2f(pos.x - radius.x, pos.y - radius.y); GL11.glVertex2f(pos.x - radius.x, pos.y + radius.y); GL11.glVertex2f(pos.x + radius.x, pos.y + radius.y); GL11.glVertex2f(pos.x + radius.x, pos.y - radius.y); GL11.glEnd(); }
/** * @see org.newdawn.slick.opengl.renderer.SGL#enterOrtho(int, int) */ public void enterOrtho(int xsize, int ysize) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, width, height, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glTranslatef((width-xsize)/2, (height-ysize)/2,0); }
public void update(ByteBuffer pixelBuffer, int width, int height, Bitmap.Format format) { this.bitmap = null; this.width = width; this.height = height; GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, this.width, this.height, getTextureFormat(format), getTextureBufferType(format), pixelBuffer); }
/** * Draws a rectangle with a horizontal gradient between the specified colors. * x2 and y2 are not included. */ public static void drawHorizontalGradientRect(int x1, int y1, int x2, int y2, int color1, int color2) { // this.zLevel = 300.0F; float zLevel = 0.0f; float f = (color1 >> 24 & 255) / 255.0F; float f1 = (color1 >> 16 & 255) / 255.0F; float f2 = (color1 >> 8 & 255) / 255.0F; float f3 = (color1 & 255) / 255.0F; float f4 = (color2 >> 24 & 255) / 255.0F; float f5 = (color2 >> 16 & 255) / 255.0F; float f6 = (color2 >> 8 & 255) / 255.0F; float f7 = (color2 & 255) / 255.0F; GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); GlStateManager.disableAlpha(); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); buffer.pos(x1, y1, zLevel).color(f1, f2, f3, f).endVertex(); buffer.pos(x1, y2, zLevel).color(f1, f2, f3, f).endVertex(); buffer.pos(x2, y2, zLevel).color(f5, f6, f7, f4).endVertex(); buffer.pos(x2, y1, zLevel).color(f5, f6, f7, f4).endVertex(); tessellator.draw(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); }
public static void startClip(float x1, float y1, float x2, float y2) { if (y1 > y2) { float temp = y2; y2 = y1; y1 = temp; } GL11.glEnable((int)3089); GL11.glScissor((int)((int)x1), (int)((int)((float)Display.getHeight() - y2)), (int)((int)(x2 - x1)), (int)((int)(y2 - y1))); }
public static void enableGL2D() { GL11.glDisable((int)2929); GL11.glEnable((int)3042); GL11.glDisable((int)3553); GL11.glBlendFunc((int)770, (int)771); GL11.glDepthMask((boolean)true); GL11.glEnable((int)2848); GL11.glHint((int)3154, (int)4354); GL11.glHint((int)3155, (int)4354); }
private void setupArrayPointers() { GL11.glVertexPointer(3, GL11.GL_FLOAT, 28, 0L); GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 28, 12L); GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 28, 16L); OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glTexCoordPointer(2, GL11.GL_SHORT, 28, 24L); OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit); }
@Override public void render(TileEntityXPBlock te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { if(GlobalXP.config.renderNameplate) { ITextComponent levelsText = new TextComponentString((int)te.getStoredLevels() + " (" + te.getStoredXP() + ")"); if(te != null && te.getPos() != null && rendererDispatcher.cameraHitResult != null && rendererDispatcher.cameraHitResult.getBlockPos() != null && rendererDispatcher.cameraHitResult.getBlockPos().equals(te.getPos())) { setLightmapDisabled(true); drawNameplate(te, levelsText.getFormattedText(), x, y, z, 12); setLightmapDisabled(false); } } double offset = Math.sin((te.getWorld().getTotalWorldTime() + partialTicks) * GlobalXP.config.bobSpeed / 8.0D) / 10.0D; IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(emerald, te.getWorld(), null); GlStateManager.enableRescaleNormal(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.enableBlend(); RenderHelper.enableStandardItemLighting(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.pushMatrix(); GlStateManager.translate(x + 0.5D, y + 0.4D + offset, z + 0.5D); GlStateManager.rotate((te.getWorld().getTotalWorldTime() + partialTicks) * 4.0F * (float)GlobalXP.config.spinSpeed, 0.0F, 1.0F, 0.0F); model = ForgeHooksClient.handleCameraTransforms(model, TransformType.GROUND, false); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Minecraft.getMinecraft().getRenderItem().renderItem(emerald, model); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.disableBlend(); }
public void renderCrosshair() { GL11.glLineWidth(1.0f); GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.5f); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(-CROSSHAIR_WIDTH, -0.5f); GL11.glVertex2f(-CROSSHAIR_INNER_WIDTH, -0.5f); GL11.glVertex2f(CROSSHAIR_WIDTH + 1.0f, -0.5f); GL11.glVertex2f(CROSSHAIR_INNER_WIDTH + 1.0f, -0.5f); GL11.glVertex2f(0.5f, -CROSSHAIR_WIDTH - 1.0f); GL11.glVertex2f(0.5f, -CROSSHAIR_INNER_WIDTH - 1.0f); GL11.glVertex2f(0.5f, CROSSHAIR_WIDTH); GL11.glVertex2f(0.5f, CROSSHAIR_INNER_WIDTH); GL11.glEnd(); }
private void drawQuads(int x1, int y1, int x2, int y2) { GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2i(x1, y1); GL11.glVertex2i(x2, y1); GL11.glVertex2i(x2, y2); GL11.glVertex2i(x1, y2); GL11.glEnd(); }
public static void shadeModel(int mode) { if (mode != activeShadeModel) { activeShadeModel = mode; GL11.glShadeModel(mode); } }
@Override public void render(float alpha) { AppUI.clearBuffer(GL11.GL_COLOR_BUFFER_BIT); AppUI.clearColors(0f, 0f, 0f, 1); window.beingNVGFrame(); Theme.renderBox(window.getNVGID(), 0, 0, window.getWidth(), window.getHeight(), Theme.setColor(1, 1, 1, 1, Theme.colorA), 0, 0, 0, 0); Theme.renderImage(window.getNVGID(), 0, 0, window.getWidth(), window.getHeight(), wallpaper, 1); window.endNVGFrame(); }
public static void preWater() { if (usedDepthBuffers >= 2) { GlStateManager.setActiveTexture(33995); checkGLError("pre copy depth"); GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, renderWidth, renderHeight); checkGLError("copy depth"); GlStateManager.setActiveTexture(33984); } ShadersTex.bindNSTextures(defaultTexture.getMultiTexID()); }
private static void setFog(int param) { if (param != fogState.mode) { fogState.mode = param; GL11.glFogi(GL11.GL_FOG_MODE, param); } }
@Override protected void renderEquippedItems(EntityLivingBase entity, float unknown) { GL11.glColor3f(1.0F, 1.0F, 1.0F); super.renderEquippedItems(entity, unknown); ItemStack itemstack = entity.getHeldItem(); // The weapon you're holding if (itemstack != null && itemstack.getItem() != null) { GL11.glPushMatrix(); GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); float scale = 0.625F; GL11.glTranslatef(0.3F, 0.2F, -0.25F); // 0.0F, 0.1875F, 0.0F, left/right, up/down, forward/backward? GL11.glScalef(scale, -scale, scale); GL11.glRotatef(-20.0F, 1.0F, 0.0F, 0.0F); // -100 GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); int color = itemstack.getItem().getColorFromItemStack(itemstack, 0); float colorR = (float) (color >> 16 & 255) / 255.0F; float colorB = (float) (color >> 8 & 255) / 255.0F; float colorG = (float) (color & 255) / 255.0F; GL11.glColor4f(colorR, colorB, colorG, 1.0F); this.renderManager.itemRenderer.renderItem(entity, itemstack, 0); GL11.glPopMatrix(); } this.renderStoredItems((Entity_BB) entity); }
public void renderLightMapOnPlayerHead(World world, EntityLivingBase wearer) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_ONE); GlStateManager.depthMask(true); float brightnessX = OpenGlHelper.lastBrightnessX; float brightnessY = OpenGlHelper.lastBrightnessY; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680, 0); head.render(0.01F); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightnessX, brightnessY); GlStateManager.disableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.popMatrix(); }
/** * Draw with the WorldRenderer */ private static void draw(VertexBuffer renderer, int x, int y, int width, int height, int red, int green, int blue, int alpha) { renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); renderer.pos((x + 0), (y + 0), 0.0D).color(red, green, blue, alpha).endVertex(); renderer.pos((x + 0), (y + height), 0.0D).color(red, green, blue, alpha).endVertex(); renderer.pos((x + width), (y + height), 0.0D).color(red, green, blue, alpha).endVertex(); renderer.pos((x + width), (y + 0), 0.0D).color(red, green, blue, alpha).endVertex(); Tessellator.getInstance().draw(); }
private void indicateStorageType(int width, int height){ if(isDepthAttachment()){ GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, format, width, height, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null); }else{ GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, format, width, height, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null); } }
private static void setTextureClamped(boolean p_110997_0_) { if (p_110997_0_) { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE); } else { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); } }