List of usage examples for org.lwjgl.opengl GL11 glColor4f
public static native void glColor4f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green, @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha);
From source file:com.sr2610.steampunkd.handbook.pages.PageCraftingRecipe.java
License:Creative Commons License
@Override @SideOnly(Side.CLIENT)/* w w w . j a v a2s . co m*/ public void renderRecipe(IGuiHandbookEntry gui, int mx, int my) { final FontRenderer fontRendererObj = ((GuiScreen) gui).mc.fontRendererObj; final boolean unicode = fontRendererObj.getUnicodeFlag(); fontRendererObj.setUnicodeFlag(true); fontRendererObj.setUnicodeFlag(unicode); oreDictRecipe = shapelessRecipe = false; final IRecipe recipe = recipes.get(recipeAt); renderCraftingRecipe(gui, recipe); final TextureManager render = Minecraft.getMinecraft().renderEngine; render.bindTexture(craftingOverlay); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1F, 1F, 1F, 1F); ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop() + 10, 0, 0, gui.getWidth(), gui.getHeight()); int iconX = gui.getLeft() + 115; final int iconY = gui.getTop() + 12 + 10; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (shapelessRecipe) { ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16); if ((mx >= iconX) && (my >= iconY) && (mx < (iconX + 16)) && (my < (iconY + 16))) TooltipHelper.renderTooltip(mx, my, Arrays.asList(I18n.format("steampunkd.handbook.shapeless"))); iconX = gui.getLeft() + 95; } render.bindTexture(craftingOverlay); GL11.glEnable(GL11.GL_BLEND); if (oreDictRecipe) { ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16); if ((mx >= iconX) && (my >= iconY) && (mx < (iconX + 16)) && (my < (iconY + 16))) TooltipHelper.renderTooltip(mx, my, Arrays.asList(I18n.format("steampunked.handbook.oredict"))); } if (oreDictRecipe) ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16); GL11.glDisable(GL11.GL_BLEND); }
From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java
License:Mozilla Public License
private void drawColor(Node node, Color color) { GL11.glColor4f(color.red, color.green, color.blue, color.alpha); drawFrontFace(node, 0.0f, GL11.GL_FILL); }
From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java
License:Mozilla Public License
private void drawHierarchy(Node node) { if (node == null || node.bounds.width == 0 || node.bounds.height == 0 || !node.isShowing() || !node.isVisible()) {// ww w . j a va 2s. c om return; } // Give a 3d depth. GL11.glPushMatrix(); final float depth = node.depth * mDepth; // Node's translation. GL11.glTranslatef(node.bounds.x, -node.bounds.y, depth); final Drawable background = node.getBackground(); final Drawable content = node.getContent(); final boolean hasBackground = node.isBackgroundShown && (background.displayListId != -1); final boolean hasContent = node.isContentShown && (content.displayListId != -1); if (mIsPicking) { GL11.glColor4f(node.pickColor[0], node.pickColor[1], node.pickColor[2], node.pickColor[3]); drawFrontFace(node, 0.0f, GL11.GL_FILL); // Draw the depth, only if we show in actual mode. // If not, if we are splitting content, draw a layer for it. if (mShowDepth) { drawDepth(node, -mDepth, GL11.GL_FILL); } else if (mSplitContent && hasBackground && hasContent) { drawFrontFace(node, -mDepth / 2.0f, GL11.GL_FILL); } } else { if (!mIsOrtho && mShowDepth) { GL11.glPushAttrib(GL11.GL_STENCIL_BUFFER_BIT); GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); drawDepthCube(node, depth); GL11.glPopAttrib(); } if (hasBackground && hasContent) { // Both background and content are available. // Draw background at a depth if needed. if (mSplitContent) GL11.glTranslatef(0.0f, 0.0f, -mDepth / 2.0f); GL11.glCallList(background.displayListId); if (mSplitContent) GL11.glTranslatef(0.0f, 0.0f, mDepth / 2.0f); GL11.glCallList(content.displayListId); } else if (hasBackground) { GL11.glCallList(background.displayListId); } else if (hasContent) { GL11.glCallList(content.displayListId); } // Stencil shouldn't know about bounds. GL11.glPushAttrib(GL11.GL_STENCIL_BUFFER_BIT | GL11.GL_LINE_BIT); GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); // Show bounds. if (!mIsOrtho && mShowDepth) { loadColor(ColorType.BOUNDS_NORMAL); } else { if (node.isSelected) { GL11.glLineWidth(2.0f); loadColor(ColorType.BOUNDS_SELECTION); } else { loadColor(ColorType.BOUNDS_NORMAL); } } if (node.isSelected || !mIsOrtho || mShowBounds) { drawFrontFace(node, 0.0f, GL11.GL_LINE); } // Show a bounding box for split content in perspective mode. if (!mIsOrtho && !mShowDepth && mSplitContent && hasBackground && hasContent) { drawFrontFace(node, -mDepth / 2.0f, GL11.GL_LINE); } GL11.glPopAttrib(); } for (Node child : node.children) { drawHierarchy(child); } GL11.glPopMatrix(); }
From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java
License:Mozilla Public License
private void loadColor(ColorType type) { switch (type) { case COLOR_WHITE: GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); break;//from w w w.java2 s . c o m case COLOR_BLACK: GL11.glColor4f(0.0f, 0.0f, 0.0f, 1.0f); break; case BOUNDS_SELECTION: GL11.glColor4f(1.0f, 0.45f, 0.45f, 1.0f); break; case BOUNDS_NORMAL: GL11.glColor4f(0.33f, 0.33f, 0.33f, 1.0f); break; case LAYER_BACKGROUND: GL11.glColor4f(0.50f, 0.658f, 0.733f, 0.5f); break; case LAYER_CONTENT: GL11.glColor4f(0.976f, 0.823f, 0.592f, 0.5f); break; case LAYER_NONE: GL11.glColor4f(0.85f, 0.85f, 0.85f, 0.5f); break; case OVERDRAW_BLUE: GL11.glColor4f(0.7f, 0.7f, 1.0f, 0.7f); break; case OVERDRAW_GREEN: GL11.glColor4f(0.7f, 1.0f, 0.7f, 0.7f); break; case OVERDRAW_RED_LOW: GL11.glColor4f(1.0f, 0.7f, 0.7f, 0.7f); break; case OVERDRAW_RED_HIGH: GL11.glColor4f(1.0f, 0.3f, 0.3f, 0.7f); break; } }
From source file:com.stormister.rediscovered.RenderTileEntityTable.java
License:Open Source License
/** * Renders the TileEntity for the chest at a position. *//*from ww w . j av a 2 s . c om*/ public void render(TileEntityTable par1TileEntityChest, double par2, double par4, double par6, float par8) { int i; this.bindTexture(field_110871_a); if (!par1TileEntityChest.hasWorldObj()) { i = 0; } else { Block block = par1TileEntityChest.getBlockType(); i = par1TileEntityChest.getBlockMetadata(); if (block instanceof BlockTable && i == 0) { i = par1TileEntityChest.getBlockMetadata(); } } ModelTable modelchest; modelchest = this.chestModel; GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) par2, (float) par4 + 1.0F, (float) par6 + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); short short1 = 0; GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); float f1 = par1TileEntityChest.prevLidAngle + (par1TileEntityChest.lidAngle - par1TileEntityChest.prevLidAngle) * par8; float f2; f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; modelchest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); //*********************************************** //RENDERS ITEM ON TABLE //*********************************************** // ItemStack itemstack = par1TileEntityChest.getTopItemStacks(); // // if (itemstack != null) // { // EntityItem entityitem = new EntityItem(par1TileEntityChest.worldObj, 0.0D, 0.0D, 0.0D, itemstack); // entityitem.getEntityItem().stackSize = 1; // entityitem.hoverStart = 0.0F; // GL11.glPushMatrix(); // GL11.glTranslatef(-0.453125F * (float)Direction.offsetX[par1TileEntityChest.hangingDirection], -0.18F, -0.453125F * (float)Direction.offsetZ[par1TileEntityChest.hangingDirection]); // GL11.glRotatef(180.0F + par1TileEntityChest.rotationYaw, 0.0F, 1.0F, 0.0F); // GL11.glRotatef((float)(-90 * par1TileEntityChest.getRotation()), 0.0F, 0.0F, 1.0F); // RenderItem.renderInFrame = true; // RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); // RenderItem.renderInFrame = false; // GL11.glPopMatrix(); // } }
From source file:com.teambr.bookshelf.util.RenderUtils.java
License:Creative Commons License
/** * Used to prepare the rendering state. For basic stuff that you want things to behave on *//*from w ww . j av a 2s .c om*/ public static void prepareRenderState() { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); }
From source file:com.teambr.bookshelf.util.RenderUtils.java
License:Creative Commons License
/** * Un-does the prepare state//from w w w . jav a2 s .c o m */ public static void restoreRenderState() { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderHelper.enableStandardItemLighting(); GL11.glDisable(GL11.GL_ALPHA_TEST); }
From source file:com.teambrmodding.luxetumbra.utils.RenderUtils.java
License:Creative Commons License
/** * Set the GL color. You should probably reset it after this * * @param color The color to set/* ww w . ja v a 2s . c o m*/ */ public static void setColor(Color color) { GL11.glColor4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, color.getAlpha() / 255F); }
From source file:com.telinc1.rpjg.Game.java
License:Apache License
private void draw() { GL11.glColor4f(1f, 1f, 1f, 1f); ModuleManager.getInstance().renderModules(); }
From source file:com.telinc1.rpjg.module.Module.java
License:Apache License
/** * Renders the module's graphics and UI elements. * Also applied the screen darkening effect for modal modules.<br /> * Generally not a good idea to override this. *///from www . j a v a 2s .c o m public void render() { if (this.isModal()) { DrawingUtils.unbindTextures(); // Not going to change this to use DrawingUtils until // I don't make actual modal modules. // Don't want untested code! GL11.glPushAttrib(DrawingUtils.GL_COLOR_BITS); GL11.glColor4f(0f, 0f, 0f, .5f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2i(0, 0); GL11.glVertex2i(Display.getWidth(), 0); GL11.glVertex2i(Display.getWidth(), Display.getHeight()); GL11.glVertex2i(0, Display.getHeight()); GL11.glEnd(); GL11.glPopAttrib(); } this.renderGraphics(); this.renderUI(); for (Gui gui : this.getGUIs()) { gui.render(); } }