List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:com.darkona.adventurebackpack.client.render.CopygirlRenderUtils.java
License:Open Source License
public static void renderItemIn3d(ItemStack stack) { TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); // Not sure why but this can be null when the world loads. if (textureManager == null) { return;/*from w w w . ja v a2 s . c o m*/ } Item item = stack.getItem(); GL11.glPushMatrix(); Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.5F, -0.5F, 1 / 32.0F); int passes = item.getRenderPasses(stack.getItemDamage()); for (int pass = 0; pass < passes; pass++) { textureManager.bindTexture(((stack.getItemSpriteNumber() == 0) ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture)); IIcon icon = item.getIcon(stack, pass); if (icon != null) { float minU = icon.getMinU(); float maxU = icon.getMaxU(); float minV = icon.getMinV(); float maxV = icon.getMaxV(); CopygirlRenderUtils.setColorFromInt(item.getColorFromItemStack(stack, pass)); ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); } } if (stack.hasEffect(0)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); textureManager.bindTexture(glint); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:com.dbi.games.fortress.ui.MainAppWindow.java
License:Open Source License
/** * Creates new form MainAppWin/*from ww w . ja va 2 s .c om*/ */ public MainAppWindow() { initComponents(); glCanvas.addComponentListener(new ComponentListener() { public void componentShown(ComponentEvent e) { setNeedValidation(); } public void componentResized(ComponentEvent e) { setNeedValidation(); } public void componentMoved(ComponentEvent e) { setNeedValidation(); } public void componentHidden(ComponentEvent e) { setNeedValidation(); } }); File currentDir = new File("lib/natives"); if (!currentDir.exists()) { // JOptionPane.showMessageDialog(null, "directory location: "+currentDir.getAbsolutePath()+" does not exist!"); currentDir = new File("build/libs/natives"); } Logger.getLogger("LWJGLThread").log(Level.INFO, "LWJGL directory is " + currentDir.getAbsolutePath()); System.setProperty("org.lwjgl.librarypath", currentDir.getAbsolutePath()); Thread glThread = new Thread("GLThread") { @Override public void run() { long lastFrame = System.nanoTime(); long currentFrame; try { Display.setParent(glCanvas); Display.create(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glClearColor(0f, 0f, 0f, 0f); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0f, (float) glCanvas.getWidth(), (float) glCanvas.getHeight(), 0f, -1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glViewport(0, 0, glCanvas.getWidth(), glCanvas.getHeight()); MainEngine.get().graphicsEngine().buildDefaultRenderers(); while (MainEngine.get().isRunning()) { try { currentFrame = System.nanoTime(); MainEngine.get().renderScene(currentFrame - lastFrame); lastFrame = currentFrame; Display.update(); if (needUpdateViewport) { needUpdateViewport = false; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, glCanvas.getWidth(), glCanvas.getHeight(), 0, -1, 1); GL11.glViewport(0, 0, glCanvas.getWidth(), glCanvas.getHeight()); } } catch (Throwable ex) { ex.printStackTrace(); Logger.getLogger("LWJGLThread").log(Level.SEVERE, "There was a SEROUS uncaught error in the render thread. Shutting down. Please restart!", ex); MainEngine.get().shutdown(); } } } catch (Throwable ex) { throw new RuntimeException("There was an issue starting LWJGL!", ex); } } }; glThread.start(); }
From source file:com.dinasgames.engine.graphics.RenderTarget.java
public void resetGLStates() { //if(true){return;} if (activate(true)) { //GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);/*from ww w . ja v a 2 s. c o m*/ GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); //GL11.glEnable(GL13.GL_MULTISAMPLE); mCache.glStatesSet = true; applyBlendMode(BlendMode.BlendAlpha); applyTransform(Transform.Identity); applyTexture(null); mCache.useVertexCache = false; setView(new View(getView())); } }
From source file:com.dyonovan.tcnodetracker.lib.truetyper.FontHelper.java
License:Open Source License
public static void drawString(String s, float x, float y, TrueTypeFont font, float scaleX, float scaleY, float rotationZ, float... rgba) { Minecraft mc = Minecraft.getMinecraft(); ScaledResolution sr = new ScaledResolution(mc.getMinecraft(), mc.displayWidth, mc.displayHeight); if (mc.gameSettings.hideGUI) { return;// ww w.ja v a2s .com } int amt = 1; if (sr.getScaleFactor() == 1) { amt = 2; } FloatBuffer matrixData = BufferUtils.createFloatBuffer(16); GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, matrixData); FontHelper.set2DMode(matrixData); GL11.glPushMatrix(); y = mc.displayHeight - (y * sr.getScaleFactor()) - (((font.getLineHeight() / amt))); float tx = (x * sr.getScaleFactor()) + (font.getWidth(s) / 2); float tranx = tx + 2; float trany = y + (font.getLineHeight() / 2); GL11.glTranslatef(tranx, trany, 0); GL11.glRotatef(rotationZ, 0f, 0f, 1f); GL11.glTranslatef(-tranx, -trany, 0); GL11.glEnable(GL11.GL_BLEND); if (s.contains(formatEscape)) { String[] pars = s.split(formatEscape); float totalOffset = 0; for (int i = 0; i < pars.length; i++) { String par = pars[i]; float[] c = rgba; if (i > 0) { c = Formatter.getFormatted(par.charAt(0)); par = par.substring(1, par.length()); } font.drawString((x * sr.getScaleFactor() + totalOffset), y, par, scaleX / amt, scaleY / amt, c); totalOffset += font.getWidth(par); } } else { font.drawString((x * sr.getScaleFactor()), y, s, scaleX / amt, scaleY / amt, rgba); } GL11.glPopMatrix(); GL11.glDisable(GL11.GL_BLEND); FontHelper.set3DMode(); }
From source file:com.enderville.mod.client.gui.mainmenu.GuiLinks.java
License:LGPL
@Override public void drawBackground(int par1) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG);/*from www . j a v a 2s. c o m*/ Tessellator tessellator = Tessellator.instance; this.mc.getTextureManager().bindTexture(optionsBackground); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float f = 32.0F; tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(4210752); tessellator.addVertexWithUV(0.0D, (double) this.height, 0.0D, 0.0D, (double) ((float) this.height / f + (float) par1)); tessellator.addVertexWithUV((double) this.width, (double) this.height, 0.0D, (double) ((float) this.width / f), (double) ((float) this.height / f + (float) par1)); tessellator.addVertexWithUV((double) this.width, 0.0D, 0.0D, (double) ((float) this.width / f), (double) par1); tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, (double) par1); tessellator.draw(); }
From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java
License:LGPL
private void drawPanorama(int par1, int par2, float par3) { Tessellator tessellator = Tessellator.instance; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();/*from w ww . j av a 2 s. com*/ GL11.glLoadIdentity(); Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); byte b0 = 8; for (int k = 0; k < b0 * b0; ++k) { GL11.glPushMatrix(); float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F; float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F; float f3 = 0.0F; GL11.glTranslatef(f1, f2, f3); GL11.glRotatef(MathHelper.sin(((float) this.panoramaTimer + par3) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-((float) this.panoramaTimer + par3) * 0.1F, 0.0F, 1.0F, 0.0F); for (int l = 0; l < 6; ++l) { GL11.glPushMatrix(); if (l == 1) { GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); } if (l == 2) { GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } if (l == 3) { GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); } if (l == 4) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); } if (l == 5) { GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); } this.mc.getTextureManager().bindTexture(titlePanoramaPaths[l]); tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(16777215, 255 / (k + 1)); float f4 = 0.0F; tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double) (0.0F + f4), (double) (0.0F + f4)); tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, (double) (1.0F - f4), (double) (0.0F + f4)); tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, (double) (1.0F - f4), (double) (1.0F - f4)); tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double) (0.0F + f4), (double) (1.0F - f4)); tessellator.draw(); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glColorMask(true, true, true, false); } tessellator.setTranslation(0.0D, 0.0D, 0.0D); GL11.glColorMask(true, true, true, true); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_DEPTH_TEST); }
From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java
License:LGPL
/** * Renders the skybox in the main menu//from ww w . j a va 2 s.com */ private void renderSkybox(int par1, int par2, float par3) { GL11.glViewport(0, 0, 256, 256); this.drawPanorama(par1, par2, par3); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_TEXTURE_2D); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3); GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); float f1 = this.width > this.height ? 120.0F / (float) this.width : 120.0F / (float) this.height; float f2 = (float) this.height * f1 / 256.0F; float f3 = (float) this.width * f1 / 256.0F; GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); // tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F); int k = this.width; int l = this.height; tessellator.addVertexWithUV(0.0D, (double) l, (double) this.zLevel, (double) (0.5F - f2), (double) (0.5F + f3)); tessellator.addVertexWithUV((double) k, (double) l, (double) this.zLevel, (double) (0.5F - f2), (double) (0.5F - f3)); tessellator.addVertexWithUV((double) k, 0.0D, (double) this.zLevel, (double) (0.5F + f2), (double) (0.5F - f3)); tessellator.addVertexWithUV(0.0D, 0.0D, (double) this.zLevel, (double) (0.5F + f2), (double) (0.5F + f3)); tessellator.draw(); }
From source file:com.ethylamine.fsynthesis.client.renderer.tileentity.TungstenChestTESR.java
License:Open Source License
private void renderTungstenChest(TungstenChestTE te, float tick) { final int x = te.xCoord; final int y = te.yCoord; final int z = te.zCoord; final World world = te.getWorldObj(); GL11.glPushMatrix();/*from w w w .ja va 2 s. c o m*/ // Position Renderer bindTexture(TEXTURE); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(1.0F, -1.0F, -1.0F); //flip & rotate GL11.glTranslatef(0.5F, 0.5F, 0.5F); //translate block pos around fromBLK ORG final int metadata = world.getBlockMetadata(x, y, z); final Orientation orientation = Orientation.getdecodedOrientation(metadata); GL11.glRotatef(getAngleFromOrientation(orientation), 0.0F, -1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); //translate BLK ORG to block pos //lid angle. float adjLDAngle = te.getPrevLidAngle() + (te.getLidAngle() - te.getPrevLidAngle()) * tick; adjLDAngle = 1.0F - adjLDAngle; adjLDAngle = 1.0F - adjLDAngle * adjLDAngle * adjLDAngle; //noinspection NumericCastThatLosesPrecision vanillaChest.chestLid.rotateAngleX = -(adjLDAngle * (float) Math.PI / 2.0F); vanillaChest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:com.farincorporated.frameutils.client.rendering.FramePistonRenderer.java
@Override public void renderTileEntityAt(TileEntity ti, double x, double y, double z, float timeSinceLastTick) { TileFramePiston tile = (TileFramePiston) ti; ResourceLocation framemap = super.getFrame(tile.getMaterialType()); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glPushMatrix();/*from w w w.j a va 2s .co m*/ GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); GL11.glScaled(scale, scale, scale); double[] dir = this.directionRotate(tile.getFace()); GL11.glRotated(dir[0], dir[1], dir[2], dir[3]); this.renderPistonBase(framemap); if (tile.isStill()) { GL11.glPushMatrix(); this.bindTexture(this.pistonmap); modelpiston.renderPart("pistsontop"); GL11.glPopMatrix(); GL11.glPopMatrix(); } else { GL11.glPopMatrix(); GL11.glPushMatrix(); this.TranslateModel(x, y, z, tile.getFace(), tile.getProgress()); GL11.glScaled(scale, scale, scale); GL11.glRotated(dir[0], dir[1], dir[2], dir[3]); GL11.glPushMatrix(); this.bindTexture(framemap); this.modelpistonext.renderPart("outterframe"); GL11.glPopMatrix(); GL11.glPushMatrix(); this.bindTexture(framemap); this.modelpistonext.renderPart("innerframe"); GL11.glPopMatrix(); GL11.glPushMatrix(); this.bindTexture(pistonmap); this.modelpistonext.renderPart("shaft"); GL11.glPopMatrix(); GL11.glPushMatrix(); this.bindTexture(pistonmap); this.modelpistonext.renderPart("face"); GL11.glPopMatrix(); GL11.glPopMatrix(); } }
From source file:com.farincorporated.frameutils.client.rendering.FramePistonRenderer.java
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { //RenderBlocks render = (RenderBlocks) data[0]; GL11.glDisable(GL11.GL_CULL_FACE); GL11.glPushMatrix();/*w w w. j a v a2 s . c o m*/ GL11.glScaled(scale, scale, scale); double[] dir = this.directionRotate(1); GL11.glRotated(dir[0], dir[1], dir[2], dir[3]); this.renderPistonBase(this.frametextures .get(item.hasTagCompound() ? item.getTagCompound().getString("frame_material") : "wood")); GL11.glPushMatrix(); this.bindTexture(this.pistonmap); modelpiston.renderPart("pistsontop"); GL11.glPopMatrix(); GL11.glPopMatrix(); }