List of usage examples for org.lwjgl.opengl GL11 glEnable
public static void glEnable(@NativeType("GLenum") int target)
From source file:com.irr310.i3d.scene.I3dScene.java
License:Open Source License
/** * Draw the scene.//from w ww . jav a 2s . co m * Place 3 lights and draw the root element * @param gl context gl to draw the image * @param camera point of view of the draw */ public void display(I3dCamera camera) { float[] lightAmbient1 = { 0.0f, 0.0f, 0.0f, 1.0f }; float[] lightDiffuse1 = { 0.75f, 0.75f, 0.75f, 1.0f }; float[] lightPosition1 = { 100.0f, 100.0f, -100.0f, 0.0f }; FloatBuffer lightPosition0 = BufferUtils.createFloatBuffer(4); lightPosition0.put(70.0f); lightPosition0.put(50.0f); lightPosition0.put(100.0f); lightPosition0.put(0.0f); lightPosition0.flip(); //GL11.GLLightf(GL11.GL_LIGHT1, GL11.GL_AMBIENT, lightAmbient1); // Setup The Ambient Light //GL11.GLLightf(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, lightDiffuse1); // Setup The Diffuse Light //GL11.GLLightf(GL11.GL_LIGHT1, GL11.GL_POSITION, lightPosition1, 0); // Position The Light GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, lightPosition0); GL11.glEnable(GL11.GL_LIGHT1); // Enable Light One float[] lightAmbient2 = { 0.0f, 0.0f, 0.0f, 1.0f }; float[] lightDiffuse2 = { 0.3f, 0.3f, 0.3f, 1.0f }; float[] lightPosition2 = { 100.0f, -100.0f, -100.0f, 0.0f }; //GL11.GLLightfv(GL11.GL_LIGHT2, GL11.GL_AMBIENT, lightAmbient2, 0); // Setup The Ambient Light //GL11.GLLightfv(GL11.GL_LIGHT2, GL11.GL_DIFFUSE, lightDiffuse2, 0); // Setup The Diffuse Light //GL11.GLLightfv(GL11.GL_LIGHT2, GL11.GL_POSITION, lightPosition2, 0); // Position The Light //GL11.glEnable(GL11.GL_LIGHT2); // Enable Light One float[] lightAmbient3 = { 0.0f, 0.0f, 0.0f, 1.0f }; float[] lightDiffuse3 = { 0.2f, 0.2f, 0.20f, 1.0f }; float[] lightPosition3 = { -100.0f, -100.0f, -100.0f, 0.0f }; //GL11.GLLightfv(GL11.GL_LIGHT3, GL11.GL_AMBIENT, lightAmbient3, 0); // Setup The Ambient Light //GL11.GLLightfv(GL11.GL_LIGHT3, GL11.GL_DIFFUSE, lightDiffuse3, 0); // Setup The Diffuse Light //GL11.GLLightfv(GL11.GL_LIGHT3, GL11.GL_POSITION, lightPosition3, 0); // Position The Light //GL11.glEnable(GL11.GL_LIGHT3); // Enable Light One //GL11.GLLightModeli(GL11.GL_LIGHT_MODEL_TWO_SIDE, GL11.GL_TRUE); float[] globalAmbiant = { 0.0f, 0.0f, 0.0f, 1.0f }; //GL11.GLLightModelfv(GL11.GL_LIGHT_MODEL_AMBIENT, globalAmbiant,0); rootElement.display(camera); //rootElement.select( camera, 0); }
From source file:com.itszuvalex.femtocraft.research.gui.GuiResearch.java
License:Open Source License
/** * Draws the screen and all the components in it. *//*from ww w . j a v a 2s . com*/ @Override public void drawScreen(int par1, int par2, float par3) { if (Mouse.isButtonDown(0)) { int k = (this.width - this.researchPaneWidth) / 2; int l = (this.height - this.researchPaneHeight) / 2; int i1 = k + 8; int j1 = l + 17; if ((this.isMouseButtonDown == 0 || this.isMouseButtonDown == 1) && par1 >= i1 && par1 < i1 + 224 && par2 >= j1 && par2 < j1 + 155) { if (this.isMouseButtonDown == 0) { this.isMouseButtonDown = 1; } else { guiMapX -= (double) (par1 - this.mouseX); guiMapY -= (double) (par2 - this.mouseY); field_74124_q = field_74117_m = guiMapX; field_74123_r = field_74115_n = guiMapY; } this.mouseX = par1; this.mouseY = par2; } if (field_74124_q < (double) guiMapTop) { field_74124_q = (double) guiMapTop; } if (field_74123_r < (double) guiMapLeft) { field_74123_r = (double) guiMapLeft; } if (field_74124_q >= (double) guiMapBottom) { field_74124_q = (double) (guiMapBottom - 1); } if (field_74123_r >= (double) guiMapRight) { field_74123_r = (double) (guiMapRight - 1); } } else { this.isMouseButtonDown = 0; } this.drawDefaultBackground(); this.genAchievementBackground(par1, par2, par3); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); this.drawTitle(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); }
From source file:com.itszuvalex.femtocraft.research.gui.GuiResearch.java
License:Open Source License
protected void genAchievementBackground(int par1, int par2, float par3) { int k = MathHelper.floor_double(field_74117_m + (guiMapX - field_74117_m) * (double) par3); int l = MathHelper.floor_double(field_74115_n + (guiMapY - field_74115_n) * (double) par3); if (k < guiMapTop) { k = guiMapTop;//from w ww. ja va 2s .c o m } if (l < guiMapLeft) { l = guiMapLeft; } if (k >= guiMapBottom) { k = guiMapBottom - 1; } if (l >= guiMapRight) { l = guiMapRight - 1; } int i1 = (this.width - this.researchPaneWidth) / 2; int j1 = (this.height - this.researchPaneHeight) / 2; int k1 = i1 + 16; int l1 = j1 + 17; this.zLevel = 0.0F; GL11.glDepthFunc(GL11.GL_GEQUAL); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 0.0F, -200.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); int i2 = k + 288 >> 4; int j2 = l + 288 >> 4; int k2 = (k + 288) % 16; int l2 = (l + 288) % 16; Random random = new Random(); int i3; int j3; int k3; // Make background for (i3 = 0; i3 * 16 - l2 < 155; ++i3) { float f1 = 0.6F - (float) (j2 + i3) / 25.0F * 0.3F; GL11.glColor4f(f1, f1, f1, 1.0F); for (k3 = 0; k3 * 16 - k2 < 224; ++k3) { random.setSeed((long) (1234 + i2 + k3)); random.nextInt(); j3 = random.nextInt(1 + j2 + i3) + (j2 + i3) / 2; IIcon icon = Blocks.sand.getIcon(0, 0); if (j3 <= 37 && j2 + i3 != 35) { if (j3 == 22) { if (random.nextInt(2) == 0) { icon = Femtocraft.blockOrePlatinum().getIcon(0, 0); } else { icon = Femtocraft.blockOreFarenite().getIcon(0, 0); } } else if (j3 == 10) { icon = Femtocraft.blockOreTitanium().getIcon(0, 0); } else if (j3 == 8) { icon = Femtocraft.blockOreThorium().getIcon(0, 0); } else if (j3 > 4) { icon = Blocks.stone.getIcon(0, 0); } else if (j3 > 0) { icon = Blocks.dirt.getIcon(0, 0); } } else { icon = Blocks.bedrock.getIcon(0, 0); } Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); this.drawTexturedModelRectFromIcon(k1 + k3 * 16 - k2, l1 + i3 * 16 - l2, icon, 16, 16); } } GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); // GL11.glDisable(GL11.GL_TEXTURE_2D); int l3; int i4; int j4; for (ITechnology tech : Femtocraft.researchManager().getTechnologies()) { ResearchStatus rs = researchStatus.getTechnology(tech.getName()); if (rs == null) { continue; } if (tech.getPrerequisites() != null) { for (String cr : tech.getPrerequisites()) { TechNode node = Femtocraft.researchManager().getNode(tech); for (IGraphNode parent : node.getParents()) { IGraphNode next = parent; IGraphNode prev = node; while (next instanceof DummyTechNode) { k3 = prev.getDisplayX() * 24 - k + 11 + k1; j3 = prev.getDisplayY() * 24 - l + 11 + l1 - 11; j4 = next.getDisplayX() * 24 - k + 11 + k1; l3 = next.getDisplayY() * 24 - l + 11 + l1 + 11; boolean flag6 = !rs.researched(); i4 = Math.sin( (double) (Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) > 0.6D ? 255 : 130; int color = tech.getLevel().getColor(); if (flag6) { color += (i4 << 24); } else { color += (255 << 24); } // this.drawHorizontalLine(k3, j4, j3, color); // this.drawVerticalLine(j4, j3, l3, color); RenderUtils.drawLine(k3, j4, j3, l3, 1, color); RenderUtils.drawLine(j4, j4, l3 - 22, l3, 1, color); // Dummy nodes should only have 1 parent prev = next; next = next.getParents().get(0); } k3 = prev.getDisplayX() * 24 - k + 11 + k1; j3 = prev.getDisplayY() * 24 - l + 11 + l1 - 11; j4 = next.getDisplayX() * 24 - k + 11 + k1; l3 = next.getDisplayY() * 24 - l + 11 + l1 + 11; boolean flag6 = !rs.researched(); i4 = Math.sin((double) (Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) > 0.6D ? 255 : 130; int color = tech.getLevel().getColor(); if (flag6) { color += (i4 << 24); } else { color += (255 << 24); } // this.drawHorizontalLine(k3, j4, j3, color); // this.drawVerticalLine(j4, j3, l3, color); RenderUtils.drawLine(k3, j4, j3, l3, 1, color); } } } } ITechnology tooltipTech = null; RenderItem renderitem = new RenderItem(); RenderHelper.enableGUIStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); int l4; int i5; for (ITechnology tech : Femtocraft.researchManager().getTechnologies()) { ResearchStatus ts = researchStatus.getTechnology(tech.getName()); if (ts == null) { continue; } TechNode node = Femtocraft.researchManager().getNode(tech); j4 = node.getDisplayX() * 24 - k; l3 = node.getDisplayY() * 24 - l; if (j4 >= -24 && l3 >= -24 && j4 <= 224 && l3 <= 155) { float f2; if (ts.researched()) { f2 = 1.0F; GL11.glColor4f(f2, f2, f2, 1.0F); } else { f2 = Math.sin((double) (Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) < 0.6D ? 0.6F : 0.8F; GL11.glColor4f(f2, f2, f2, 1.0F); } // else { // f2 = 0.3F; // GL11.glColor4f(f2, f2, f2, 1.0F); // } Minecraft.getMinecraft().getTextureManager().bindTexture(achievementTextures); i5 = k1 + j4; l4 = l1 + l3; GL11.glEnable(GL11.GL_BLEND);// Forge: Specifically enable blend because it is needed here. And we // fix Generic RenderItem's leakage of it. if (tech.isKeystone()) { this.drawTexturedModalRect(i5 - 2, l4 - 2, 26, 202, 26, 26); } else { this.drawTexturedModalRect(i5 - 2, l4 - 2, 0, 202, 26, 26); } GL11.glDisable(GL11.GL_BLEND); //Forge: Cleanup states we set. // // if (!this.statFileWriter.canUnlockAchievement(achievement2)) // { // float f3 = 0.1F; // GL11.glColor4f(f3, f3, f3, 1.0F); // renderitem.renderWithColor = false; // } GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure Lighting is disabled. Fixes MC-33065 GL11.glEnable(GL11.GL_CULL_FACE); RenderHelper.enableGUIStandardItemLighting(); // GL11.glDisable(GL11.GL_LIGHTING); // GL11.glBlendFunc(GL11.GL_DST_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // GL11.glEnable(GL12.GL_RESCALE_NORMAL); // GL11.glEnable(GL11.GL_COLOR_MATERIAL); // GL11.glEnable(GL11.GL_LIGHTING); // GL11.glEnable(GL11.GL_CULL_FACE); renderitem.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), tech.getDisplayItem(), i5 + 3, l4 + 3); RenderHelper.disableStandardItemLighting(); // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // GL11.glDisable(GL11.GL_LIGHTING); // GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_LIGHTING); // if (!this.statFileWriter.canUnlockAchievement(achievement2)) // { // renderitem.renderWithColor = true; // } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if (par1 >= k1 && par2 >= l1 && par1 < k1 + 224 && par2 < l1 + 155 && par1 >= i5 && par1 <= i5 + 22 && par2 >= l4 && par2 <= l4 + 22) { tooltipTech = tech; } } } GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(achievementTextures); this.drawTexturedModalRect(i1, j1, 0, 0, this.researchPaneWidth, this.researchPaneHeight); // GL11.glPopMatrix(); this.zLevel = 0.0F; GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); super.drawScreen(par1, par2, par3); if (tooltipTech != null) { ResearchStatus status = researchStatus.getTechnology(tooltipTech.getName()); String s = tooltipTech.getName(); String s1 = tooltipTech.getShortDescription(); j4 = par1 + 12; l3 = par2 - 4; i5 = Math.max(this.fontRendererObj.getStringWidth(s), 120); l4 = this.fontRendererObj.splitStringWidth(s1, i5); if (status.researched()) { l4 += 12; } this.drawGradientRect(j4 - 3, l3 - 3, j4 + i5 + 3, l3 + l4 + 3 + 12, -1073741824, -1073741824); this.fontRendererObj.drawSplitString(s1, j4, l3 + 12, i5, -6250336); if (status.researched()) { this.fontRendererObj.drawStringWithShadow("Researched!", j4, l3 + l4 + 4, -7302913); } // Keep Commented // else { // i5 = Math.max(this.fontRenderer.getStringWidth(s), 120); // String s2 = I18n.getStringParams("achievement.requires", // new Object[] { I18n // .getString(tooltipTech.parentAchievement // .getName()) }); // i4 = this.fontRenderer.splitStringWidth(s2, i5); // this.drawGradientRect(j4 - 3, l3 - 3, j4 + i5 + 3, l3 + i4 + 12 // + 3, -1073741824, -1073741824); // this.fontRenderer // .drawSplitString(s2, j4, l3 + 12, i5, -9416624); // } this.fontRendererObj.drawStringWithShadow(s, j4, l3, status.researched() ? (tooltipTech.isKeystone() ? -128 : -1) : (tooltipTech.isKeystone() ? -8355776 : -8355712)); } GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LIGHTING); RenderHelper.disableStandardItemLighting(); }
From source file:com.itszuvalex.femtocraft.research.gui.GuiResearchConsole.java
License:Open Source License
@Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); int k = (this.width - xSize) / 2; int l = (this.height - ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, xSize, ySize); int progress = console.getResearchProgressScaled(78); this.drawTexturedModalRect(k + 64, l + 65, 0, 166, progress, 6); if (console.displayTech() != null || console.isResearching()) { String name;// ww w .ja v a 2 s. c om if (console.isResearching()) { name = console.getResearchingName(); } else { name = console.displayTech(); } ITechnology tech = Femtocraft.researchManager().getTechnology(name); if (tech != null) { String s = tech.getName(); this.fontRendererObj.drawString(s, k + 71 + (165 - 71 - this.fontRendererObj.getStringWidth(s)) / 2, l + 20, FemtocraftUtils.colorFromARGB(255, 255, 255, 255)); if (console.isResearching()) { s = String.format("%d%s", console.getResearchProgressScaled(100), "%"); this.fontRendererObj.drawString(s, k + 168 - this.fontRendererObj.getStringWidth(s), l + 40, FemtocraftUtils.colorFromARGB(255, 255, 255, 255)); } else { s = "Begin"; this.fontRendererObj.drawString(s, k + 85 - this.fontRendererObj.getStringWidth(s) / 2, l + 36 + (52 - 36 - this.fontRendererObj.FONT_HEIGHT) / 2, FemtocraftUtils.colorFromARGB(255, 255, 255, 255)); } RenderItem render = new RenderItem(); GL11.glDisable(GL11.GL_BLEND); //Forge: Cleanup states we set. GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure Lighting is disabled. Fixes MC-33065 GL11.glEnable(GL11.GL_CULL_FACE); RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); render.renderItemAndEffectIntoGUI(fontRendererObj, Minecraft.getMinecraft().getTextureManager(), tech.getDisplayItem(), k + 110, l + 33); RenderHelper.disableStandardItemLighting(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } } }
From source file:com.jmanpenilla.carbonmod.client.render.item.RenderCompressionChamberItem.java
License:LGPL
private static void renderCompressionChamber(float x, float y, float z, float scale) { GL11.glPushMatrix();//from ww w .ja va2s. com // Disable Lighting Calculations GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(x, y, z); FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE); GL11.glScalef(scale, scale, scale); GL11.glRotatef(180f, 0f, 0f, 1f); RenderCompressionChamber.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); // Re-enable Lighting Calculations GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:com.jmex.bui.BComponent.java
License:Open Source License
/** * Activates scissoring and sets the scissor region to the intersection of the current region * (if any) and the specified rectangle. After rendering the scissored region, call * {@link #restoreScissorState} to restore the previous state. * * @param store a rectangle to hold the previous scissor region for later restoration * @return <code>true</code> if scissoring was already enabled, false if it was not. *//*from ww w . j a v a 2s.c o m*/ protected static boolean intersectScissorBox(Rectangle store, int x, int y, int width, int height) { boolean enabled = GL11.glIsEnabled(GL11.GL_SCISSOR_TEST); if (enabled) { GL11.glGetInteger(GL11.GL_SCISSOR_BOX, _bbuf); store.set(_bbuf.get(0), _bbuf.get(1), _bbuf.get(2), _bbuf.get(3)); int x1 = Math.max(x, store.x), y1 = Math.max(y, store.y), x2 = Math.min(x + width, store.x + store.width), y2 = Math.min(y + height, store.y + store.height); GL11.glScissor(x, y, Math.max(0, x2 - x1), Math.max(0, y2 - y1)); } else { GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glScissor(x, y, width, height); } return enabled; }
From source file:com.kanbekotori.keycraft.renderer.RenderJavelin.java
License:Open Source License
public void doRender(EntityJavelin entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) { this.bindEntityTexture(entity); GL11.glPushMatrix();//from w w w.j av a 2s . c o m GL11.glTranslated(x, y, z); // GL11.glTranslatef(0.0F, entity.height / 2.0F, 0.0F); GL11.glRotatef(entity.prevRotationYaw - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(entity.prevRotationPitch, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f10 = 0.05625F; GL11.glScalef(f10, f10, f10); for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-3.25D, -0.5D, 0.0D, 1.0D / 16.0D, 14.0D / 16.0D); // tessellator.addVertexWithUV(3.25D, -0.5D, 0.0D, 14.0D / 16.0D, 1.0D / 16.0D); // tessellator.addVertexWithUV(3.25D, 0.5D, 0.0D, 16.0D / 16.0D, 3.0D / 16.0D); // tessellator.addVertexWithUV(-3.25D, 0.5D, 0.0D, 3.0D / 16.0D, 16.0D / 16.0D); // tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:com.kauridev.lunarfever.graphics.TextureLoader.java
License:Open Source License
public static Texture loadTexture(String file) { Texture texture = cache.get(file);/*from w w w. j av a 2s. co m*/ if (texture != null && texture.getTexture().valid()) { return texture; } BufferedImage image = loadImage(file); GL11.glEnable(GL11.GL_TEXTURE_2D); int id = GL11.glGenTextures(); // bind GL11.glBindTexture(GL11.GL_TEXTURE_2D, id); // set filter GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); // set wrap GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); // set unpack alignment GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1); GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); // send data to gpu GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, image.getWidth(), image.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, loadBuffer(image)); // Create texture texture = new Texture(id, image.getWidth(), image.getHeight()); cache.put(file, texture); return texture; }
From source file:com.kauridev.lunarfever.Lunar.java
License:Open Source License
private void initOpenGL() { try {/*from w w w . j a v a 2 s .c o m*/ Display.setDisplayMode(new DisplayMode(TARGET_WIDTH, TARGET_HEIGHT)); Display.setTitle("Lunar Fever"); Display.setFullscreen(false); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, TARGET_WIDTH, 0, TARGET_HEIGHT, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:com.kegare.caveworld.client.gui.GuiListSlot.java
License:Minecraft Mod Public
private void drawPanorama(float ticks) { Tessellator tessellator = Tessellator.instance; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();/*from w w w.j av a 2s. co m*/ 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.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); OpenGlHelper.glBlendFunc(770, 771, 1, 0); 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((panoramaTimer + ticks) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-(panoramaTimer + ticks) * 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); } mc.getTextureManager().bindTexture(getPanoramaPaths().getPath(l)); tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(16777215, 255 / (k + 1)); float f4 = 0.0F; tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, 0.0F + f4, 0.0F + f4); tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, 1.0F - f4, 0.0F + f4); tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, 1.0F - f4, 1.0F - f4); tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, 0.0F + f4, 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_DEPTH_TEST); }