List of usage examples for org.lwjgl.opengl GL11 glBlendFunc
public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor)
From source file:com.minestellar.moon.world.SkyRendererMoon.java
License:Open Source License
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { WorldProviderMoon gcProvider = null; if (world.provider instanceof WorldProviderMoon) { gcProvider = (WorldProviderMoon) world.provider; }/*from w ww. ja v a 2s. c o m*/ GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(1, 1, 1); final Tessellator var23 = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_FOG); GL11.glColor3f(0, 0, 0); GL11.glCallList(this.glSkyList); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderHelper.disableStandardItemLighting(); float var10; float var11; float var12; float var20 = 0; if (gcProvider != null) { var20 = gcProvider.getStarBrightness(partialTicks); } if (var20 > 0.0F) { GL11.glColor4f(1.0F, 1.0F, 1.0F, var20); GL11.glCallList(this.starGLCallList); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); GL11.glPopMatrix(); GL11.glPushMatrix(); // SUN: GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SkyRendererMoon.sunTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 150.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 150.0D, var12, 0.0D, 1.0D); var23.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_BLEND); // EARTH: var12 = 50.0F; final float earthRotation = (float) (world.getSpawnPoint().posZ - mc.thePlayer.posZ) * 0.01F; GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(earthRotation, 1.0F, 0.0F, 0.0F); GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(SkyRendererMoon.earthTexture); world.getMoonPhase(); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, -400.0D, var12, 0, 1); var23.addVertexWithUV(var12, -400.0D, var12, 1, 1); var23.addVertexWithUV(var12, -400.0D, -var12, 1, 0); var23.addVertexWithUV(-var12, -400.0D, -var12, 0, 0); var23.draw(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_FOG); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); final double var25 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon(); if (var25 < 0.0D) { GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 12.0F, 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); var10 = 1.0F; var11 = -((float) (var25 + 65.0D)); var12 = -var10; var23.startDrawingQuads(); var23.setColorRGBA_I(0, 255); var23.addVertex(-var10, var11, var10); var23.addVertex(var10, var11, var10); var23.addVertex(var10, var12, var10); var23.addVertex(-var10, var12, var10); var23.addVertex(-var10, var12, -var10); var23.addVertex(var10, var12, -var10); var23.addVertex(var10, var11, -var10); var23.addVertex(-var10, var11, -var10); var23.addVertex(var10, var12, -var10); var23.addVertex(var10, var12, var10); var23.addVertex(var10, var11, var10); var23.addVertex(var10, var11, -var10); var23.addVertex(-var10, var11, -var10); var23.addVertex(-var10, var11, var10); var23.addVertex(-var10, var12, var10); var23.addVertex(-var10, var12, -var10); var23.addVertex(-var10, var12, -var10); var23.addVertex(-var10, var12, var10); var23.addVertex(var10, var12, var10); var23.addVertex(var10, var12, -var10); var23.draw(); } GL11.glColor3f(70F / 256F, 70F / 256F, 70F / 256F); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -((float) (var25 - 16.0D)), 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); }
From source file:com.mrcrayfish.furniture.gui.GuiDishwasher.java
License:Open Source License
public void drawColour(int x, int y, int width, int height, int par4) { WorldRenderer renderer = Tessellator.getInstance().getWorldRenderer(); GL11.glDisable(GL11.GL_TEXTURE_2D);//from w w w .j a v a 2s . c om GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); renderer.startDrawingQuads(); renderer.setColorOpaque_I(par4); renderer.addVertex(x, y, 0.0D); renderer.addVertex(x, y + height, 0.0D); renderer.addVertex(x + width, y + height, 0.0D); renderer.addVertex(x + width, y, 0.0D); Tessellator.getInstance().draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:com.mrcrayfish.furniture.render.tileentity.BlenderRenderer.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double posX, double posY, double posZ, float p_180535_8_, int p_180535_9_) { TileEntityBlender blender = (TileEntityBlender) tileEntity; ItemStack[] ingredients = blender.getIngredients(); GL11.glPushMatrix();//from ww w . ja va 2 s .c o m GL11.glTranslatef((float) posX + 0.5F, (float) posY + 0.2F, (float) posZ + 0.5F); GL11.glScalef(0.65F, 0.65F, 0.65F); entityFood.hoverStart = 0.0F; for (int i = 0; i < ingredients.length; i++) { if (ingredients[i] != null) { entityFood.setEntityItemStack(ingredients[i]); GL11.glRotatef(i * -90F, 0, 1, 0); GL11.glRotatef(blender.progress * 18F, 0, 1, 0); Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityFood, 0.0D, 0.2D, 0.0D, 0.0F, 0.0F); } } GL11.glPopMatrix(); if (blender.isBlending() | blender.drinkCount > 0) { Tessellator tessellator = Tessellator.getInstance(); GL11.glPushMatrix(); GL11.glTranslatef((float) posX + 0.5F, (float) posY + 0.05F, (float) posZ + 0.5F); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND); float alpha = blender.isBlending() ? (blender.progress / 200F) : (blender.drinkCount > 0 ? 1.0F : 0.0F); GL11.glColor4f(blender.currentRed / 255F, blender.currentGreen / 255F, blender.currentBlue / 255F, alpha); float height = blender.isBlending() ? 0.8F : (0.275F + (0.525F * (blender.drinkCount / 6F))); GL11.glBegin(GL11.GL_QUADS); // North Face GL11.glVertex3d(-0.2, 0.275, -0.2); GL11.glVertex3d(0.2, 0.275, -0.2); GL11.glVertex3d(0.2, height, -0.2); GL11.glVertex3d(-0.2, height, -0.2); // South Face GL11.glVertex3d(-0.2, 0.275, 0.2); GL11.glVertex3d(0.2, 0.275, 0.2); GL11.glVertex3d(0.2, height, 0.2); GL11.glVertex3d(-0.2, height, 0.2); // West Face GL11.glVertex3d(-0.2, 0.275, -0.2); GL11.glVertex3d(-0.2, 0.275, 0.2); GL11.glVertex3d(-0.2, height, 0.2); GL11.glVertex3d(-0.2, height, -0.2); // East Face GL11.glVertex3d(0.2, 0.275, -0.2); GL11.glVertex3d(0.2, 0.275, 0.2); GL11.glVertex3d(0.2, height, 0.2); GL11.glVertex3d(0.2, height, -0.2); // Top Face GL11.glVertex3d(-0.2, height, -0.2); GL11.glVertex3d(0.2, height, -0.2); GL11.glVertex3d(0.2, height, 0.2); GL11.glVertex3d(-0.2, height, 0.2); // Bottom Face GL11.glVertex3d(-0.2, 0.275, -0.2); GL11.glVertex3d(0.2, 0.275, -0.2); GL11.glVertex3d(0.2, 0.275, 0.2); GL11.glVertex3d(-0.2, 0.275, 0.2); GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F); GL11.glPopMatrix(); } }
From source file:com.mrcrayfish.furniture.render.tileentity.CupRenderer.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double posX, double posY, double posZ, float p_180535_8_, int p_180535_9_) { TileEntityCup tileEntityCup = (TileEntityCup) tileEntity; if (tileEntityCup.getDrink() != null) { Tessellator tessellator = Tessellator.getInstance(); GL11.glPushMatrix();/*from ww w. ja v a 2s .c om*/ GL11.glTranslatef((float) posX + 0.5F, (float) posY, (float) posZ + 0.5F); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(tileEntityCup.red / 255F, tileEntityCup.green / 255F, tileEntityCup.blue / 255F, 1.0F); GL11.glBegin(GL11.GL_QUADS); // North Face GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(0.125, 0.4, -0.125); GL11.glVertex3d(-0.125, 0.4, -0.125); // South Face GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125); GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125); GL11.glVertex3d(0.125, 0.4, 0.125); GL11.glVertex3d(-0.125, 0.4, 0.125); // West Face GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125); GL11.glVertex3d(-0.125, 0.4, 0.125); GL11.glVertex3d(-0.125, 0.4, -0.125); // East Face GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125); GL11.glVertex3d(0.125, 0.4, 0.125); GL11.glVertex3d(0.125, 0.4, -0.125); // Top Face GL11.glVertex3d(-0.125, 0.4, -0.125); GL11.glVertex3d(0.125, 0.4, -0.125); GL11.glVertex3d(0.125, 0.4, 0.125); GL11.glVertex3d(-0.125, 0.4, 0.125); // Bottom Face GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125); GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125); GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125); GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F); GL11.glPopMatrix(); } }
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
public void renderGUIandWorld(float renderPartialTicks) { this.farPlaneDistance = (float) this.mc.gameSettings.ofRenderDistanceFine; if (Config.isFogFancy()) { this.farPlaneDistance *= 0.95F; }/*from w w w . ja v a 2 s. c o m*/ if (Config.isFogFast()) { this.farPlaneDistance *= 0.83F; } if (this.prevFarPlaneDistance != this.farPlaneDistance) { _FBOInitialised = false; this.prevFarPlaneDistance = this.farPlaneDistance; } //Ensure FBO are in place and initialized if (!setupFBOs()) return; boolean guiShowingThisFrame = false; int mouseX = 0; int mouseY = 0; ScaledResolution var15 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); int var16 = var15.getScaledWidth(); int var17 = var15.getScaledHeight(); if ((this.mc.theWorld != null && !this.mc.gameSettings.hideGUI && this.mc.thePlayer.getSleepTimer() == 0) || this.mc.currentScreen != null || this.mc.loadingScreen.isEnabled()) { //Render all UI elements into guiFBO mouseX = Mouse.getX() * var16 / this.mc.displayWidth; mouseY = var17 - Mouse.getY() * var17 / this.mc.displayHeight - 1; guiFBO.bindRenderTarget(); GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); GL11.glClearColor(0, 0, 0, 0); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0.0D, var15.getScaledWidth_double(), var15.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); guiShowingThisFrame = true; } // Display loading / progress window if necessary if (this.mc.loadingScreen.isEnabled()) { this.mc.loadingScreen.vrRender(var16, var17); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); } else if (this.mc.theWorld != null && !this.mc.gameSettings.hideGUI && !this.blankGUIUntilWorldValid) { //Disable any forge gui crosshairs and helmet overlay (pumkinblur) if (Reflector.ForgeGuiIngame_renderCrosshairs.exists()) { Reflector.ForgeGuiIngame_renderCrosshairs.setValue(false); Reflector.ForgeGuiIngame_renderHelmet.setValue(false); } //Draw in game GUI this.mc.ingameGUI.renderGameOverlay(renderPartialTicks, this.mc.currentScreen != null, mouseX, mouseY); guiAchievement.updateAchievementWindow(); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); } if (this.blankGUIUntilWorldValid) { if (this.mc.theWorld != null) this.blankGUIUntilWorldValid = false; } if (this.mc.loadingScreen.isEnabled() == false && this.mc.currentScreen != null && !this.blankGUIUntilWorldValid) { try { this.mc.currentScreen.drawScreen(mouseX, mouseY, renderPartialTicks); } catch (Throwable var13) { CrashReport var11 = CrashReport.makeCrashReport(var13, "Rendering screen"); throw new ReportedException(var11); } GL11.glDisable(GL11.GL_LIGHTING); //inventory messes up fog color sometimes... This fixes GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); drawMouseQuad(mouseX, mouseY); } //Setup render target if (mc.vrSettings.useDistortion) { preDistortionFBO.bindRenderTarget(); } else if (this.mc.vrSettings.useSupersample) { postDistortionFBO.bindRenderTarget(); eyeRenderParams._renderScale = 1.0f; } else { unbindFBORenderTarget(); eyeRenderParams._renderScale = 1.0f; } GL11.glClearColor(0, 0, 0, 1); GL11.glEnable(GL11.GL_SCISSOR_TEST); if (this.mc.theWorld != null) { //If we're in-game, render in-game stuff this.mc.mcProfiler.startSection("level"); if (this.mc.renderViewEntity == null) { this.mc.renderViewEntity = this.mc.thePlayer; } EntityLivingBase renderViewEntity = this.mc.renderViewEntity; this.mc.mcProfiler.endStartSection("center"); //Used by fog comparison, 3rd person camera/block collision detection renderOriginX = renderViewEntity.lastTickPosX + (renderViewEntity.posX - renderViewEntity.lastTickPosX) * (double) renderPartialTicks; renderOriginY = renderViewEntity.lastTickPosY + (renderViewEntity.posY - renderViewEntity.lastTickPosY) * (double) renderPartialTicks; renderOriginZ = renderViewEntity.lastTickPosZ + (renderViewEntity.posZ - renderViewEntity.lastTickPosZ) * (double) renderPartialTicks; if (this.mc.currentScreen == null) { this.mc.mcProfiler.endStartSection("pick"); getPointedBlock(renderPartialTicks); } // Update sound engine setSoundListenerOrientation(); } //Update gui Yaw if (guiShowingThisFrame && !guiShowingLastFrame) { guiHeadYaw = this.cameraYaw - this.mc.lookaimController.getBodyYawDegrees(); } guiShowingLastFrame = guiShowingThisFrame; //Now, actually render world for (int renderSceneNumber = 0; renderSceneNumber < 2; ++renderSceneNumber) { setupEyeViewport(renderSceneNumber); this.mc.mcProfiler.endStartSection("camera"); //transform camera with pitch,yaw,roll + neck model + game effects setupCameraTransform(renderPartialTicks, renderSceneNumber); if (this.mc.theWorld != null) { GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); this.renderWorld(renderPartialTicks, 0L, renderSceneNumber); this.disableLightmap(renderPartialTicks); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); } else { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer on the framebuffer to black GL11.glDisable(GL11.GL_BLEND); } if (guiShowingThisFrame) { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); guiFBO.bindTexture(); // Prevent black border at top / bottom of GUI GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE); if (this.mc.theWorld != null && this.mc.vrSettings.hudLockToHead) { GL11.glLoadIdentity(); if (renderSceneNumber == 0) GL11.glMultMatrix(eyeRenderParams.gl_getLeftViewportTransform()); else GL11.glMultMatrix(eyeRenderParams.gl_getRightViewportTransform()); GL11.glRotatef(180f - this.mc.vrSettings.hudYawOffset, 0f, 1f, 0f); GL11.glRotatef(-this.mc.vrSettings.hudPitchOffset, 1f, 0f, 0f); // GL11.glRotatef(cameraRoll, 0f, 0f, 1f); GL11.glTranslatef(0.0f, 0.0f, this.mc.vrSettings.hudDistance - this.mc.vrSettings.eyeProtrusion); GL11.glRotatef(180f, 0f, 1f, 0f);//Not sure why this is necessary... normals/backface culling maybe? } else { float guiYaw = 0f; if (this.mc.theWorld != null) { if (this.mc.vrSettings.lookMoveDecoupled) guiYaw = this.mc.lookaimController.getBodyYawDegrees(); else guiYaw = guiHeadYaw + this.mc.lookaimController.getBodyYawDegrees(); guiYaw -= this.mc.vrSettings.hudYawOffset; } else guiYaw = guiHeadYaw + this.mc.lookaimController.getBodyYawDegrees(); GL11.glRotatef(-guiYaw, 0f, 1f, 0f); float guiPitch = 0f; if (this.mc.theWorld != null) guiPitch = -this.mc.vrSettings.hudPitchOffset; // if( this.mc.vrSettings.allowMousePitchInput) // guiPitch += this.mc.lookaimController.getBodyPitchDegrees(); GL11.glRotatef(guiPitch, 1f, 0f, 0f); GL11.glTranslatef(0.0f, 0.0f, this.mc.vrSettings.hudDistance); GL11.glRotatef(180f, 0f, 1f, 0f);//Not sure why this is necessary... normals/backface culling maybe? } GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (this.mc.theWorld != null) GL11.glColor4f(1, 1, 1, this.mc.vrSettings.hudOpacity); else GL11.glColor4f(1, 1, 1, 1); if (!this.mc.vrSettings.hudOcclusion) GL11.glDisable(GL11.GL_DEPTH_TEST); drawQuad2(this.mc.displayWidth, this.mc.displayHeight, this.mc.vrSettings.hudScale * this.mc.vrSettings.hudDistance); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); unbindTexture(); //mc.checkGLError("GUI"); } if (calibrationHelper != null) { float x = lookX * mc.vrSettings.hudDistance; float y = lookY * mc.vrSettings.hudDistance; float z = lookZ * mc.vrSettings.hudDistance; GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glTranslatef(x, y, z); GL11.glRotatef(-this.cameraYaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef(this.cameraPitch, 1.0F, 0.0F, 0.0F); GL11.glRotatef(this.cameraRoll, 0.0F, 0.0F, 1.0F); float textScale = (float) Math.sqrt((x * x + y * y + z * z)); GL11.glScalef(-INITIAL_CALIBRATION_TEXT_SCALE * textScale, -INITIAL_CALIBRATION_TEXT_SCALE * textScale, -INITIAL_CALIBRATION_TEXT_SCALE * textScale); String calibrating = "Calibrating " + calibrationHelper.currentPlugin.getName() + "..."; mc.fontRenderer.drawStringWithShadow(calibrating, -mc.fontRenderer.getStringWidth(calibrating) / 2, -8, /*white*/16777215); String calibrationStep = calibrationHelper.calibrationStep; // mc.fontRenderer.drawStringWithShadow(calibrationStep, -mc.fontRenderer.getStringWidth(calibrationStep)/2, 8, /*white*/16777215); int column = 8; ArrayList<String> wrapped = new ArrayList<String>(); Utils.wordWrap(calibrationStep, CALIBRATION_TEXT_WORDWRAP_LEN, wrapped); for (String line : wrapped) { mc.fontRenderer.drawStringWithShadow(line, -mc.fontRenderer.getStringWidth(line) / 2, column, /*white*/16777215); column += 16; } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_DEPTH_TEST); } } GL11.glDisable(GL11.GL_SCISSOR_TEST); doDistortionAndSuperSample(); checkLatencyTester(); // Finish frame GL11.glFinish(); // Get end frame timings endFrameTimeNanos = startVSyncPeriodNanos = System.nanoTime(); long frameTime = endFrameTimeNanos - startFrameRenderNanos; addRenderFrameTimeNanos(frameTime); mc.checkGLError("After render world and GUI"); }
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
public void renderWorld(float renderPartialTicks, long nextFrameTime, int renderSceneNumber) { RenderGlobal renderGlobal = this.mc.renderGlobal; EffectRenderer effectRenderer = this.mc.effectRenderer; EntityLivingBase renderViewEntity = this.mc.renderViewEntity; //TODO: fog color isn't quite right yet when eyes split water/air this.updateFogColor(renderPartialTicks); GL11.glClearColor(fogColorRed, fogColorGreen, fogColorBlue, 0.5f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glEnable(GL11.GL_CULL_FACE);// ww w . j av a 2 s . c om GL11.glEnable(GL11.GL_DEPTH_TEST); //mc.checkGLError("FBO init"); this.mc.mcProfiler.startSection("lightTex"); if (this.lightmapUpdateNeeded) { this.updateLightmap(renderPartialTicks); } ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2); this.mc.mcProfiler.endStartSection("frustrum"); ClippingHelperImpl.getInstance(); // setup clip, using current modelview / projection matrices if (!Config.isSkyEnabled() && !Config.isSunMoonEnabled() && !Config.isStarsEnabled()) { GL11.glDisable(GL11.GL_BLEND); } else { this.setupFog(-1, renderPartialTicks); this.mc.mcProfiler.endStartSection("sky"); renderGlobal.renderSky(renderPartialTicks); } GL11.glEnable(GL11.GL_FOG); this.setupFog(1, renderPartialTicks); if (this.mc.gameSettings.ambientOcclusion != 0) { GL11.glShadeModel(GL11.GL_SMOOTH); } this.mc.mcProfiler.endStartSection("culling"); Frustrum frustrum = new Frustrum(); frustrum.setPosition(renderOriginX, renderOriginY, renderOriginZ); this.mc.renderGlobal.clipRenderersByFrustum(frustrum, renderPartialTicks); if (renderSceneNumber == 0) { this.mc.mcProfiler.endStartSection("updatechunks"); while (!this.mc.renderGlobal.updateRenderers(renderViewEntity, false) && nextFrameTime != 0L) { long var15 = nextFrameTime - System.nanoTime(); if (var15 < 0L || var15 > 1000000000L) { break; } } } if (renderViewEntity.posY < 128.0D) { this.renderCloudsCheck(renderGlobal, renderPartialTicks); } this.mc.mcProfiler.endStartSection("prepareterrain"); this.setupFog(0, renderPartialTicks); GL11.glEnable(GL11.GL_FOG); this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); RenderHelper.disableStandardItemLighting(); this.mc.mcProfiler.endStartSection("terrain"); renderGlobal.sortAndRender(renderViewEntity, 0, (double) renderPartialTicks); GL11.glShadeModel(GL11.GL_FLAT); boolean var16 = Reflector.ForgeHooksClient.exists(); EntityPlayer var18; if (this.debugViewDirection == 0) { RenderHelper.enableStandardItemLighting(); this.mc.mcProfiler.endStartSection("entities"); if (var16) { Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(0) }); } //TODO: multiple render passes for entities? renderGlobal.renderEntities(renderViewEntity.getPosition(renderPartialTicks), frustrum, renderPartialTicks); if (var16) { Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(-1) }); } RenderHelper.disableStandardItemLighting(); } GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthMask(true); this.setupFog(0, renderPartialTicks); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); WrUpdates.resumeBackgroundUpdates(); if (Config.isWaterFancy()) { this.mc.mcProfiler.endStartSection("water"); if (this.mc.gameSettings.ambientOcclusion != 0) { GL11.glShadeModel(GL11.GL_SMOOTH); } GL11.glColorMask(false, false, false, false); int var17 = renderGlobal.renderAllSortedRenderers(1, (double) renderPartialTicks); if (this.mc.gameSettings.anaglyph) { if (anaglyphField == 0) { GL11.glColorMask(false, true, true, true); } else { GL11.glColorMask(true, false, false, true); } } else { GL11.glColorMask(true, true, true, true); } if (var17 > 0) { renderGlobal.renderAllSortedRenderers(1, (double) renderPartialTicks); } GL11.glShadeModel(GL11.GL_FLAT); } else { this.mc.mcProfiler.endStartSection("water"); renderGlobal.renderAllSortedRenderers(1, (double) renderPartialTicks); } WrUpdates.pauseBackgroundUpdates(); if (var16 && this.debugViewDirection == 0) { RenderHelper.enableStandardItemLighting(); this.mc.mcProfiler.endStartSection("entities"); Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(1) }); this.mc.renderGlobal.renderEntities(renderViewEntity.getPosition(renderPartialTicks), frustrum, renderPartialTicks); Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(-1) }); RenderHelper.disableStandardItemLighting(); } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); boolean renderOutline = this.mc.vrSettings.alwaysRenderBlockOutline || !this.mc.gameSettings.hideGUI; if (this.mc.currentScreen == null && this.cameraZoom == 1.0D && renderViewEntity instanceof EntityPlayer && this.mc.objectMouseOver != null && !renderViewEntity.isInsideOfMaterial(Material.water) && renderOutline) { var18 = (EntityPlayer) renderViewEntity; GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("outline"); if (!var16 || !Reflector.callBoolean(Reflector.ForgeHooksClient_onDrawBlockHighlight, new Object[] { renderGlobal, var18, this.mc.objectMouseOver, Integer.valueOf(0), var18.inventory.getCurrentItem(), Float.valueOf(renderPartialTicks) })) { renderGlobal.drawSelectionBox(var18, this.mc.objectMouseOver, 0, renderPartialTicks); } GL11.glEnable(GL11.GL_ALPHA_TEST); } if (this.mc.currentScreen == null && this.cameraZoom == 1.0D && renderViewEntity instanceof EntityPlayer && !renderViewEntity.isInsideOfMaterial(Material.water) && renderOutline && this.mc.vrSettings.showEntityOutline) { var18 = (EntityPlayer) renderViewEntity; if (var18 != null) { GL11.glDisable(GL11.GL_ALPHA_TEST); this.mc.mcProfiler.endStartSection("entityOutline"); if (this.bb != null) drawBoundingBox(var18, this.bb, renderPartialTicks); GL11.glEnable(GL11.GL_ALPHA_TEST); } } this.mc.mcProfiler.endStartSection("destroyProgress"); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); renderGlobal.drawBlockDamageTexture(Tessellator.instance, renderViewEntity, renderPartialTicks); GL11.glDisable(GL11.GL_BLEND); this.mc.mcProfiler.endStartSection("weather"); this.renderRainSnow(renderPartialTicks); GL11.glDisable(GL11.GL_FOG); if (renderViewEntity.posY >= 128.0D) { this.renderCloudsCheck(renderGlobal, renderPartialTicks); } this.enableLightmap((double) renderPartialTicks); this.mc.mcProfiler.endStartSection("litParticles"); RenderHelper.enableStandardItemLighting(); effectRenderer.renderLitParticles(renderViewEntity, renderPartialTicks); RenderHelper.disableStandardItemLighting(); this.setupFog(0, renderPartialTicks); this.mc.mcProfiler.endStartSection("particles"); effectRenderer.renderParticles(renderViewEntity, renderPartialTicks); this.disableLightmap((double) renderPartialTicks); if (var16) { this.mc.mcProfiler.endStartSection("FRenderLast"); Reflector.callVoid(Reflector.ForgeHooksClient_dispatchRenderLast, new Object[] { renderGlobal, Float.valueOf(renderPartialTicks) }); } if (this.mc.vrSettings.renderFullFirstPersonModel == false) { GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); this.renderHand(renderPartialTicks, renderSceneNumber); } GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); //white crosshair, with blending //Draw crosshair boolean renderCrosshair = this.mc.vrSettings.alwaysRenderInGameCrosshair || !this.mc.gameSettings.hideGUI; if (this.mc.currentScreen == null && this.mc.gameSettings.thirdPersonView == 0 && renderCrosshair) { this.mc.mcProfiler.endStartSection("crosshair"); float crossDepth = (float) Math.sqrt((crossX * crossX + crossY * crossY + crossZ * crossZ)); float scale = 0.025f * crossDepth * this.mc.vrSettings.crosshairScale; GL11.glPushMatrix(); GL11.glTranslatef(crossX, crossY, crossZ); GL11.glRotatef(-this.aimYaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef(this.aimPitch, 1.0F, 0.0F, 0.0F); if (this.mc.vrSettings.crosshairRollsWithHead) GL11.glRotatef(this.cameraRoll, 0.0F, 0.0F, 1.0F); GL11.glScalef(-scale, -scale, scale); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR); this.mc.getTextureManager().bindTexture(Gui.icons); float var7 = 0.00390625F; float var8 = 0.00390625F; Tessellator.instance.startDrawingQuads(); Tessellator.instance.addVertexWithUV(-1, +1, 0, 0, 16 * var8); Tessellator.instance.addVertexWithUV(+1, +1, 0, 16 * var7, 16 * var8); Tessellator.instance.addVertexWithUV(+1, -1, 0, 16 * var7, 0); Tessellator.instance.addVertexWithUV(-1, -1, 0, 0, 0); Tessellator.instance.draw(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); //mc.checkGLError("crosshair"); } this.mc.mcProfiler.endSection(); }
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
public void drawBoundingBox(EntityPlayer par1EntityPlayer, AxisAlignedBB bb, float par4) { GL11.glEnable(GL11.GL_BLEND);//from w w w . j av a 2s. c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); float var5 = 0.002F; double var7 = par1EntityPlayer.lastTickPosX + (par1EntityPlayer.posX - par1EntityPlayer.lastTickPosX) * (double) par4; double var9 = par1EntityPlayer.lastTickPosY + (par1EntityPlayer.posY - par1EntityPlayer.lastTickPosY) * (double) par4; double var11 = par1EntityPlayer.lastTickPosZ + (par1EntityPlayer.posZ - par1EntityPlayer.lastTickPosZ) * (double) par4; drawOutlinedBoundingBox( bb.expand((double) var5, (double) var5, (double) var5).getOffsetBoundingBox(-var7, -var9, -var11)); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
public void drawLine(EntityPlayer par1EntityPlayer, Vec3 start, Vec3 end, float par4) { GL11.glEnable(GL11.GL_BLEND);/*from w w w.j a v a 2 s .c o m*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); float var5 = 0.002F; double var7 = par1EntityPlayer.lastTickPosX + (par1EntityPlayer.posX - par1EntityPlayer.lastTickPosX) * (double) par4; double var9 = par1EntityPlayer.lastTickPosY + (par1EntityPlayer.posY - par1EntityPlayer.lastTickPosY) * (double) par4; double var11 = par1EntityPlayer.lastTickPosZ + (par1EntityPlayer.posZ - par1EntityPlayer.lastTickPosZ) * (double) par4; Tessellator var2 = Tessellator.instance; var2.startDrawing(GL11.GL_LINE_STRIP); var2.addVertex(start.xCoord, start.yCoord, start.zCoord); var2.addVertex(end.xCoord, end.yCoord, end.zCoord); var2.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:com.oneofthesevenbillion.ziah.ZiahsClient.gui.GuiScrollingList.java
License:Open Source License
public void drawScreen(int mouseX, int mouseY, float tick) { this.mouseX = mouseX; this.mouseY = mouseY; this.drawBackground(); int listLength = this.getSize(); int scrollBarXStart = this.left + this.listWidth - 6; int scrollBarXEnd = scrollBarXStart + 6; int boxLeft = this.left; int boxRight = scrollBarXStart - 1; int var10; int var11; int var13; int var19; if (Mouse.isButtonDown(0)) { if (this.initialMouseClickY == -1.0F) { boolean var7 = true; if (mouseY >= this.top && mouseY <= this.bottom) { var10 = mouseY - this.top - this.field_27261_r + (int) this.scrollDistance - 4; var11 = var10 / this.slotHeight; if (mouseX >= boxLeft && mouseX <= boxRight && var11 >= 0 && var10 >= 0 && var11 < listLength) { boolean var12 = var11 == this.selectedIndex && System.currentTimeMillis() - this.lastClickTime < 250L; this.elementClicked(var11, var12); this.selectedIndex = var11; this.lastClickTime = System.currentTimeMillis(); } else if (mouseX >= boxLeft && mouseX <= boxRight && var10 < 0) { this.func_27255_a(mouseX - boxLeft, mouseY - this.top + (int) this.scrollDistance - 4); var7 = false; }//from w w w . ja v a 2s . co m if (mouseX >= scrollBarXStart && mouseX <= scrollBarXEnd) { this.scrollFactor = -1.0F; var19 = this.getContentHeight() - (this.bottom - this.top - 4); if (var19 < 1) { var19 = 1; } var13 = (int) ((float) ((this.bottom - this.top) * (this.bottom - this.top)) / (float) this.getContentHeight()); if (var13 < 32) { var13 = 32; } if (var13 > this.bottom - this.top - 8) { var13 = this.bottom - this.top - 8; } this.scrollFactor /= (float) (this.bottom - this.top - var13) / (float) var19; } else { this.scrollFactor = 1.0F; } if (var7) { this.initialMouseClickY = mouseY; } else { this.initialMouseClickY = -2.0F; } } else { this.initialMouseClickY = -2.0F; } } else if (this.initialMouseClickY >= 0.0F) { this.scrollDistance -= (mouseY - this.initialMouseClickY) * this.scrollFactor; this.initialMouseClickY = mouseY; } } else { while (Mouse.next()) { int var16 = Mouse.getEventDWheel(); if (var16 != 0) { if (var16 > 0) { var16 = -1; } else if (var16 < 0) { var16 = 1; } this.scrollDistance += var16 * this.slotHeight / 2; } } this.initialMouseClickY = -1.0F; } this.applyScrollLimits(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); Tessellator var18 = Tessellator.instance; try { ((TextureManager) ModLoader.getPrivateValue(Minecraft.class, this.client, 7)) .func_110577_a(Gui.field_110325_k); } catch (Exception e) { e.printStackTrace(); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float var17 = 32.0F; var18.startDrawingQuads(); var18.setColorOpaque_I(2105376); var18.addVertexWithUV(this.left, this.bottom, 0.0D, this.left / var17, (this.bottom + (int) this.scrollDistance) / var17); var18.addVertexWithUV(this.right, this.bottom, 0.0D, this.right / var17, (this.bottom + (int) this.scrollDistance) / var17); var18.addVertexWithUV(this.right, this.top, 0.0D, this.right / var17, (this.top + (int) this.scrollDistance) / var17); var18.addVertexWithUV(this.left, this.top, 0.0D, this.left / var17, (this.top + (int) this.scrollDistance) / var17); var18.draw(); // boxRight = this.listWidth / 2 - 92 - 16; var10 = this.top + 4 - (int) this.scrollDistance; if (this.field_27262_q) { this.func_27260_a(boxRight, var10, var18); } int var14; for (var11 = 0; var11 < listLength; ++var11) { var19 = var10 + var11 * this.slotHeight + this.field_27261_r; var13 = this.slotHeight - 4; if (var19 <= this.bottom && var19 + var13 >= this.top) { if (this.field_25123_p && this.isSelected(var11)) { var14 = boxLeft; int var15 = boxRight; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); var18.startDrawingQuads(); var18.setColorOpaque_I(8421504); var18.addVertexWithUV(var14, var19 + var13 + 2, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(var15, var19 + var13 + 2, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV(var15, var19 - 2, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(var14, var19 - 2, 0.0D, 0.0D, 0.0D); var18.setColorOpaque_I(0); var18.addVertexWithUV(var14 + 1, var19 + var13 + 1, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(var15 - 1, var19 + var13 + 1, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV(var15 - 1, var19 - 1, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(var14 + 1, var19 - 1, 0.0D, 0.0D, 0.0D); var18.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); } this.drawSlot(var11, boxRight, var19, var13, var18); } } GL11.glDisable(GL11.GL_DEPTH_TEST); byte var20 = 4; this.overlayBackground(0, this.top, 255, 255); this.overlayBackground(this.bottom, this.listHeight, 255, 255); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_TEXTURE_2D); var18.startDrawingQuads(); var18.setColorRGBA_I(0, 0); var18.addVertexWithUV(this.left, this.top + var20, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(this.right, this.top + var20, 0.0D, 1.0D, 1.0D); var18.setColorRGBA_I(0, 255); var18.addVertexWithUV(this.right, this.top, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(this.left, this.top, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(0, 255); var18.addVertexWithUV(this.left, this.bottom, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(this.right, this.bottom, 0.0D, 1.0D, 1.0D); var18.setColorRGBA_I(0, 0); var18.addVertexWithUV(this.right, this.bottom - var20, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(this.left, this.bottom - var20, 0.0D, 0.0D, 0.0D); var18.draw(); var19 = this.getContentHeight() - (this.bottom - this.top - 4); if (var19 > 0) { var13 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight(); if (var13 < 32) { var13 = 32; } if (var13 > this.bottom - this.top - 8) { var13 = this.bottom - this.top - 8; } var14 = (int) this.scrollDistance * (this.bottom - this.top - var13) / var19 + this.top; if (var14 < this.top) { var14 = this.top; } var18.startDrawingQuads(); var18.setColorRGBA_I(0, 255); var18.addVertexWithUV(scrollBarXStart, this.bottom, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd, this.bottom, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd, this.top, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(scrollBarXStart, this.top, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(8421504, 255); var18.addVertexWithUV(scrollBarXStart, var14 + var13, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd, var14 + var13, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd, var14, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(scrollBarXStart, var14, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(12632256, 255); var18.addVertexWithUV(scrollBarXStart, var14 + var13 - 1, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd - 1, var14 + var13 - 1, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd - 1, var14, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(scrollBarXStart, var14, 0.0D, 0.0D, 0.0D); var18.draw(); } this.func_27257_b(mouseX, mouseY); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); }
From source file:com.oneofthesevenbillion.ziah.ZiahsClient.util.Utils.java
License:Open Source License
/** * Draws a solid color rectangle with the specified coordinates and color. Args: x1, y1, x2, y2, color *///from w w w . j av a 2s.co m public static void drawRect(int x1, int y1, int x2, int y2, int color, float zLevel) { int var5; if (x1 < x2) { var5 = x1; x1 = x2; x2 = var5; } if (y1 < y2) { var5 = y1; y1 = y2; y2 = var5; } float var10 = (color >> 24 & 255) / 255.0F; float var6 = (color >> 16 & 255) / 255.0F; float var7 = (color >> 8 & 255) / 255.0F; float var8 = (color & 255) / 255.0F; Tessellator var9 = Tessellator.instance; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(var6, var7, var8, var10); var9.startDrawingQuads(); var9.addVertex(x1, y2, zLevel); var9.addVertex(x2, y2, zLevel); var9.addVertex(x2, y1, zLevel); var9.addVertex(x1, y1, zLevel); var9.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }