List of usage examples for org.lwjgl.opengl GL11 glGetBoolean
@NativeType("void") public static boolean glGetBoolean(@NativeType("GLenum") int pname)
From source file:itdelatrisu.opsu.render.CurveRenderState.java
License:Open Source License
/** * Backup the current state of the relevant OpenGL state and change it to * what's needed to draw the curve.// w w w . j a v a2s .c om */ private RenderState startRender() { RenderState state = new RenderState(); state.smoothedPoly = GL11.glGetBoolean(GL11.GL_POLYGON_SMOOTH); state.blendEnabled = GL11.glGetBoolean(GL11.GL_BLEND); state.depthEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_TEST); state.depthWriteEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_WRITEMASK); state.texEnabled = GL11.glGetBoolean(GL11.GL_TEXTURE_2D); state.texUnit = GL11.glGetInteger(GL13.GL_ACTIVE_TEXTURE); state.oldProgram = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM); state.oldArrayBuffer = GL11.glGetInteger(GL15.GL_ARRAY_BUFFER_BINDING); GL11.glDisable(GL11.GL_POLYGON_SMOOTH); GL11.glEnable(GL11.GL_BLEND); GL14.glBlendEquation(GL14.GL_FUNC_ADD); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_TEXTURE_1D); GL11.glBindTexture(GL11.GL_TEXTURE_1D, staticState.gradientTexture); GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); GL20.glUseProgram(0); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); return state; }
From source file:org.spoutcraft.client.gui.MCRenderDelegate.java
License:Open Source License
public void drawTexture(Texture textureBinding, int width, int height, Color color, boolean blend, int left, int top, boolean mipmap, int filter) { if (textureBinding == null) { return;/*from ww w. ja v a2s . c o m*/ } GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); boolean wasBlend = GL11.glGetBoolean(GL11.GL_BLEND); if (blend) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(770, 771); } GL11.glDepthMask(false); bindColor(color); SpoutClient.getHandle().renderEngine.bindTexture(textureBinding.getTextureID()); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filter); if (mipmap) { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, 8); ContextCapabilities capabilities = GLContext.getCapabilities(); if (capabilities.OpenGL30) { GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); } else if (capabilities.GL_EXT_framebuffer_object) { EXTFramebufferObject.glGenerateMipmapEXT(GL11.GL_TEXTURE_2D); } else if (capabilities.OpenGL14) { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_GENERATE_MIPMAP, GL11.GL_TRUE); } } double tLeft = 0, tTop = 0, rWidth = textureBinding.getWidth(), rHeight = textureBinding.getHeight(), tWidth = rWidth, tHeight = rHeight; if (top >= 0 && left >= 0) { tWidth = Math.min(tWidth, (width / (double) textureBinding.getImageWidth()) * textureBinding.getWidth()); tHeight = Math.min(tHeight, (height / (double) textureBinding.getImageHeight()) * textureBinding.getHeight()); tLeft = Math.min( Math.max(0, (left / (double) textureBinding.getImageWidth())) * textureBinding.getWidth(), rWidth); tTop = Math.min( Math.max(0, (top / (double) textureBinding.getImageHeight()) * textureBinding.getHeight()), rHeight); } tHeight = -tHeight; tTop = rHeight - tTop; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, height, -90, tLeft, tTop + tHeight); // draw corners tessellator.addVertexWithUV(width, height, -90, tLeft + tWidth, tTop + tHeight); tessellator.addVertexWithUV(width, 0.0D, -90, tLeft + tWidth, tTop); tessellator.addVertexWithUV(0.0D, 0.0D, -90, tLeft, tTop); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); if (blend && !wasBlend) { GL11.glDisable(GL11.GL_BLEND); } }
From source file:playn.java.JavaGL20.java
License:Apache License
@Override public boolean glGetBoolean(int pname) { return GL11.glGetBoolean(pname); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static boolean glGetBoolean(int a) { return GL11.glGetBoolean(a); }
From source file:vazkii.arl.util.RenderHelper.java
License:Open Source License
public static void renderTooltip(int x, int y, List<String> tooltipData, int color, int color2) { boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING); if (lighting) net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); if (!tooltipData.isEmpty()) { int var5 = 0; int var6; int var7; FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; for (var6 = 0; var6 < tooltipData.size(); ++var6) { var7 = fontRenderer.getStringWidth(tooltipData.get(var6)); if (var7 > var5) var5 = var7; }// w w w . j a v a2s . co m var6 = x + 12; var7 = y - 12; int var9 = 8; if (tooltipData.size() > 1) var9 += 2 + (tooltipData.size() - 1) * 10; ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft()); int right = var6 + var5 + 5; int swidth = res.getScaledWidth(); if (right > swidth) { int diff = right - swidth; var6 -= diff; } int bottom = var7 + var9 + 5; int sheight = res.getScaledHeight(); if (bottom > sheight) { int diff = bottom - sheight; var7 -= diff; } float z = 300F; drawGradientRect(var6 - 3, var7 - 4, z, var6 + var5 + 3, var7 - 3, color2, color2); drawGradientRect(var6 - 3, var7 + var9 + 3, z, var6 + var5 + 3, var7 + var9 + 4, color2, color2); drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 + var9 + 3, color2, color2); drawGradientRect(var6 - 4, var7 - 3, z, var6 - 3, var7 + var9 + 3, color2, color2); drawGradientRect(var6 + var5 + 3, var7 - 3, z, var6 + var5 + 4, var7 + var9 + 3, color2, color2); int var12 = (color & 0xFFFFFF) >> 1 | color & -16777216; drawGradientRect(var6 - 3, var7 - 3 + 1, z, var6 - 3 + 1, var7 + var9 + 3 - 1, color, var12); drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, z, var6 + var5 + 3, var7 + var9 + 3 - 1, color, var12); drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 - 3 + 1, color, color); drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12); GlStateManager.disableDepth(); for (int var13 = 0; var13 < tooltipData.size(); ++var13) { String var14 = tooltipData.get(var13); fontRenderer.drawStringWithShadow(var14, var6, var7, -1); if (var13 == 0) var7 += 2; var7 += 10; } GlStateManager.enableDepth(); } if (!lighting) net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); GlStateManager.color(1F, 1F, 1F, 1F); }
From source file:vazkii.botania.client.core.handler.TerraPickRankDisplayHandler.java
License:Open Source License
public static void render() { Minecraft mc = Minecraft.getMinecraft(); GuiScreen gui = mc.currentScreen;/*from w w w. j av a2 s. co m*/ if (gui != null && gui instanceof GuiContainer && mc.thePlayer != null && mc.thePlayer.inventory.getItemStack() == null) { GuiContainer container = (GuiContainer) gui; Slot slot = ReflectionHelper.getPrivateValue(GuiContainer.class, container, LibObfuscation.THE_SLOT); if (slot != null && slot.getHasStack()) { ItemStack stack = slot.getStack(); if (stack != null && stack.getItem() instanceof ItemTerraPick) { ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); FontRenderer font = mc.fontRenderer; int mouseX = Mouse.getX() * res.getScaledWidth() / mc.displayWidth; int mouseY = res.getScaledHeight() - Mouse.getY() * res.getScaledHeight() / mc.displayHeight; List<String> tooltip = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips); int width = 0; for (String s : tooltip) width = Math.max(width, font.getStringWidth(s)); int tooltipHeight = (tooltip.size() - 1) * 10 + 5; int height = 3; int offx = 11; int offy = 17; boolean offscreen = mouseX + width + 19 >= res.getScaledWidth(); int fixY = res.getScaledHeight() - (mouseY + tooltipHeight); if (fixY < 0) offy -= fixY; if (offscreen) offx = -13 - width; int level = ItemTerraPick.getLevel(stack); int max = ItemTerraPick.LEVELS[Math.min(ItemTerraPick.LEVELS.length - 1, level + 1)]; boolean ss = level >= ItemTerraPick.LEVELS.length - 1; int curr = ItemTerraPick.getMana_(stack); float percent = level == 0 ? 0F : (float) curr / (float) max; int rainbowWidth = Math.min(width - (ss ? 0 : 1), (int) (width * percent)); float huePer = width == 0 ? 0F : 1F / width; float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F; GL11.glDisable(GL11.GL_DEPTH_TEST); Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000); for (int i = 0; i < rainbowWidth; i++) Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F)); Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555); String rank = StatCollector.translateToLocal("botania.rank" + level).replaceAll("&", "\u00a7"); boolean light = GL11.glGetBoolean(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_LIGHTING); font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF); if (!ss) { rank = StatCollector.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00a7"); font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 0xFFFFFF); } if (light) GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); } } } }
From source file:vazkii.botania.client.core.helper.RenderHelper.java
License:Open Source License
public static void renderTooltip(int x, int y, List<String> tooltipData, int color, int color2) { boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING); if (lighting) net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); if (!tooltipData.isEmpty()) { int var5 = 0; int var6; int var7; FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; for (var6 = 0; var6 < tooltipData.size(); ++var6) { var7 = fontRenderer.getStringWidth(tooltipData.get(var6)); if (var7 > var5) var5 = var7; }/* w w w . j a v a 2 s. co m*/ var6 = x + 12; var7 = y - 12; int var9 = 8; if (tooltipData.size() > 1) var9 += 2 + (tooltipData.size() - 1) * 10; float z = 300F; drawGradientRect(var6 - 3, var7 - 4, z, var6 + var5 + 3, var7 - 3, color2, color2); drawGradientRect(var6 - 3, var7 + var9 + 3, z, var6 + var5 + 3, var7 + var9 + 4, color2, color2); drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 + var9 + 3, color2, color2); drawGradientRect(var6 - 4, var7 - 3, z, var6 - 3, var7 + var9 + 3, color2, color2); drawGradientRect(var6 + var5 + 3, var7 - 3, z, var6 + var5 + 4, var7 + var9 + 3, color2, color2); int var12 = (color & 0xFFFFFF) >> 1 | color & -16777216; drawGradientRect(var6 - 3, var7 - 3 + 1, z, var6 - 3 + 1, var7 + var9 + 3 - 1, color, var12); drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, z, var6 + var5 + 3, var7 + var9 + 3 - 1, color, var12); drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 - 3 + 1, color, color); drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12); GlStateManager.disableDepth(); for (int var13 = 0; var13 < tooltipData.size(); ++var13) { String var14 = tooltipData.get(var13); fontRenderer.drawStringWithShadow(var14, var6, var7, -1); if (var13 == 0) var7 += 2; var7 += 10; } GlStateManager.enableDepth(); } if (!lighting) net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); GlStateManager.color(1F, 1F, 1F, 1F); }
From source file:vazkii.b_baubles.client.fx.ParticleRenderDispatcher.java
License:Creative Commons License
public static void dispatch() { Tessellator tessellator = Tessellator.instance; boolean isLightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING); Profiler profiler = Minecraft.getMinecraft().mcProfiler; GL11.glDepthMask(false);/*from www . java2s. co m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); if (isLightingEnabled) GL11.glDisable(GL11.GL_LIGHTING); profiler.startSection("sparkle"); FXSparkle.dispatchQueuedRenders(tessellator); profiler.endStartSection("wisp"); FXWisp.dispatchQueuedRenders(tessellator); profiler.endSection(); if (isLightingEnabled) GL11.glEnable(GL11.GL_LIGHTING); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); }
From source file:vazkii.kap.client.util.helper.RenderHelper.java
License:Creative Commons License
public static void renderCrest(CrestData crest, double x, double y, double z, boolean bg, boolean lighting) { GL11.glPushMatrix();//from w ww. j a v a2s .c o m boolean lightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_LIGHTING); int ssx = crest.icon % 32; int ssy = crest.icon / 32; float scale = 1 / 32F; if (bg) { Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation(LibResources.ICON_HERALDRY_0)); int color = crest.color1; Color colorRGB = new Color(color); GL11.glColor3f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F); drawTexturedQuad(x, y, z - 0.01, 64, 64, ssx * scale, (ssx + 1) * scale, ssy * scale, (ssy + 1) * scale); } Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation(LibResources.ICON_HERALDRY_1)); int color1 = crest.color2; Color colorRGB = new Color(color1); GL11.glColor3f(colorRGB.getRed() / 255F, colorRGB.getGreen() / 255F, colorRGB.getBlue() / 255F); drawTexturedQuad(x, y, z + 2, 64, 64, ssx * scale, (ssx + 1) * scale, ssy * scale, (ssy + 1) * scale); if (!lightingEnabled) GL11.glDisable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:vazkii.priscemagica.client.core.helper.RenderHelper.java
License:Creative Commons License
public static void renderSpell(int x, int y, ISpell spell) { Minecraft.getMinecraft().renderEngine.func_110577_a(TextureMap.field_110576_c); boolean lightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING); if (lightingEnabled) net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); for (int i = 0; i < spell.getRequiredRenderPasses(); i++) renderIcon(x, y, spell.getIcon(i), spell.getColorForRenderPass(i)); if (lightingEnabled) net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting(); }