Example usage for org.lwjgl.opengl GL11 glColor3f

List of usage examples for org.lwjgl.opengl GL11 glColor3f

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glColor3f.

Prototype

public static native void glColor3f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green,
        @NativeType("GLfloat") float blue);

Source Link

Document

Float version of #glColor3b Color3b

Usage

From source file:taiga.gpvm.render.ColorEntityRenderer.java

License:Open Source License

@Override
public void render(Collection<Entity> ents, int pass, ReadableMatrix4 proj, ReadableMatrix4 modelview) {
    if (pass != HardcodedValues.OPAQUE_WORLD_LAYER)
        return;// ww  w . ja v  a  2s.com

    ARBShaderObjects.glUseProgramObjectARB(0);
    GL11.glPointSize(size);

    FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
    proj.store(buffer, false);
    buffer.flip();

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadMatrix(buffer);

    buffer.rewind();
    modelview.store(buffer, false);
    buffer.flip();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadMatrix(buffer);

    GL11.glBegin(GL11.GL_POINTS);

    for (Entity ent : ents) {
        ReadableVector3f loc = ent.getBounds().getCenter();
        GL11.glVertex3f(loc.getX(), loc.getY(), loc.getZ());
        GL11.glColor3f(red, green, blue);
    }

    GL11.glEnd();
}

From source file:thaumic.tinkerer.client.gui.GuiAnimationTablet.java

License:Creative Commons License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(gui);// w w  w  . j a va 2 s .  com
    drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
    String left = StatCollector.translateToLocal("ttmisc.leftClick");
    String right = StatCollector.translateToLocal("ttmisc.rightClick");
    String redstone = StatCollector.translateToLocal("ttmisc.redstoneControl");

    fontRendererObj.drawString(left, x + 48 - fontRendererObj.getStringWidth(left), y + 18, 0x999999);
    fontRendererObj.drawString(right, x + 128, y + 18, 0x999999);
    fontRendererObj.drawString(redstone, x + xSize / 2 - fontRendererObj.getStringWidth(redstone) / 2, y + 50,
            0x999999);
    GL11.glColor3f(1F, 1F, 1F);
}

From source file:thaumic.tinkerer.client.gui.GuiEnchanting.java

License:Creative Commons License

private void drawAspectBar(Aspect aspect, int x, int y, int mx, int my) {
    int totalCost = enchanter.totalAspects.getAmount(aspect);
    int current = enchanter.currentAspects.getAmount(aspect);

    int size = totalCost == 0 ? 11 : 59;

    if (totalCost == 0) {
        drawTexturedModalRect(x, y - size, 200, 0, 10, 4);
        drawTexturedModalRect(x, y - size + 4, 200, 52, 10, 10);
    } else {/* w w  w.jav  a 2s  . c o  m*/
        int pixels = (int) (48D * ((double) current / (double) totalCost));
        Color color = new Color(aspect.getColor());
        GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
        drawTexturedModalRect(x + 1, y - size + 4 + 48 - pixels, 210, 48 - pixels, 8, pixels);
        GL11.glColor3f(1F, 1F, 1F);
        drawTexturedModalRect(x, y - size, 200, 0, 10, size);
    }

    if (mx > x && mx <= x + 10 && my > y - size && my <= y) {
        List<String> tooltip = new ArrayList();
        tooltip.add('\u00a7' + aspect.getChatcolor() + aspect.getName());
        tooltip.add(current + "/" + totalCost);
        this.tooltip = tooltip;
    }
}

From source file:thaumic.tinkerer.client.gui.GuiMobMagnet.java

License:Creative Commons License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(gui);//from ww  w  . j  a va 2  s.co m
    drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
    String adult = StatCollector.translateToLocal("ttmisc.adult");
    String child = StatCollector.translateToLocal("ttmisc.child");
    stack = mobMagnet.getStackInSlot(0);

    String filter;

    if (stack != null) {
        String name = ItemSoulMould.getPatternName(stack);
        if (name.isEmpty())
            filter = StatCollector.translateToLocal("ttmisc.none");
        else
            filter = StatCollector.translateToLocal("entity." + name + ".name");
    } else
        filter = StatCollector.translateToLocal("ttmisc.all");

    fontRendererObj.drawString(filter, x + xSize / 2 - fontRendererObj.getStringWidth(filter) / 2 - 26, y + 16,
            0x999999);
    fontRendererObj.drawString(adult, x + 120, y + 30, 0x999999);
    fontRendererObj.drawString(child, x + 120, y + 50, 0x999999);
    GL11.glColor3f(1F, 1F, 1F);
}

From source file:thaumic.tinkerer.client.render.block.kami.RenderWarpGate.java

License:Creative Commons License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    IIcon topIcon = BlockWarpGate.icons[0];
    IIcon sideIcon = BlockWarpGate.icons[1];

    drawFaces(renderer, block, sideIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon, false);
    GL11.glColor3f(1F, 1F, 1F);

    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    Tessellator t = Tessellator.instance;
    t.startDrawingQuads();// w  ww. jav  a  2 s  .c  om
    t.setBrightness(255);
    t.setNormal(0, 1, 0);
    renderer.renderFaceYPos(block, 0, 0, 0, BlockWarpGate.icons[2]);
    t.draw();
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}

From source file:thaumic.tinkerer.client.render.tile.RenderTileEnchanter.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float partTicks) {
    TileEnchanter enchanter = (TileEnchanter) tileentity;

    GL11.glPushMatrix();/* www . j a v  a 2  s . c om*/
    GL11.glTranslated(d0, d1 + 0.75, d2);

    ItemStack item = enchanter.getStackInSlot(0);
    if (item != null) {
        GL11.glPushMatrix();
        GL11.glRotatef(90F, 1F, 0F, 0F);
        final float scale = 0.7F;
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslatef(0.6F, -0.2F, 0F);
        GL11.glRotatef(30F, 0F, 0F, 1F);

        ClientHelper.minecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);

        int renderPass = 0;
        do {
            IIcon icon = item.getItem().getIcon(item, renderPass);
            if (icon != null) {
                Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
                GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
                float f = icon.getMinU();
                float f1 = icon.getMaxU();
                float f2 = icon.getMinV();
                float f3 = icon.getMaxV();
                ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(),
                        icon.getIconHeight(), 1F / 16F);
                GL11.glColor3f(1F, 1F, 1F);
            }
            renderPass++;
        } while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
        GL11.glPopMatrix();
    }

    item = enchanter.getStackInSlot(1);
    if (item != null) {
        GL11.glPushMatrix();
        GL11.glRotatef(90F, 1F, 0F, 0F);
        final float scale = 0.5F;
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslatef(0.6F, 1.5F, -0.1F);
        GL11.glRotatef(-70F, 0F, 0F, 1F);
        long millis = System.currentTimeMillis();

        GL11.glTranslatef(0F, 0F, (float) (Math.cos((double) millis / 1000F) - 1.2F) / 10F);
        GL11.glTranslatef(0F, 0.325F, 0F);
        GL11.glRotatef((float) Math.cos((double) millis / 500F) * 5F, 1F, 0F, 0F);
        GL11.glTranslatef(0F, -0.325F, 0F);

        wandRenderer.renderItem(ItemRenderType.ENTITY, item, (Object[]) null);
        GL11.glPopMatrix();
    }

    GL11.glPopMatrix();
}

From source file:thaumic.tinkerer.client.render.tile.RenderTileRepairer.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float t) {
    int meta = tileentity.getWorldObj() == null ? 3 : tileentity.getBlockMetadata();
    int rotation = meta == 2 ? 0 : meta == 3 ? 180 : meta == 4 ? 270 : 90;

    TileRepairer repairer = (TileRepairer) tileentity;

    GL11.glPushMatrix();//from  w w  w . jav  a 2 s  . co  m
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    bindTexture(modelTex);
    GL11.glTranslatef(0F, 2F, 1F);
    GL11.glScalef(1F, -1F, -1F);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    GL11.glRotatef(rotation, 0F, 1F, 0F);
    model.render();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glScalef(1F, -1F, -1F);

    ItemStack item = ((TileRepairer) tileentity).getStackInSlot(0);
    if (item != null) {
        GL11.glPushMatrix();
        final float scale = 0.5F;
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslatef(-0.5F, (float) (-2.5F + Math.sin(repairer.ticksExisted / 10F) * 0.1F), 0F);

        float deg = repairer.ticksExisted * 0.75F % 360F;
        GL11.glTranslatef(1F / 2F, 1F / 2F, 1F / 32F);
        GL11.glRotatef(deg, 0F, 1F, 0F);
        GL11.glTranslatef(-1F / 2F, -1F / 2F, -1F / 32F);

        bindTexture(TextureMap.locationItemsTexture);

        int renderPass = 0;
        do {
            IIcon icon = item.getItem().getIcon(item, renderPass);
            if (icon != null) {
                Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
                GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
                float f = icon.getMinU();
                float f1 = icon.getMaxU();
                float f2 = icon.getMinV();
                float f3 = icon.getMaxV();
                ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(),
                        icon.getIconHeight(), 1F / 16F);
                GL11.glColor3f(1F, 1F, 1F);
            }
            renderPass++;
        } while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));
        GL11.glPopMatrix();
    }

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    bindTexture(modelTex);
    GL11.glScalef(1F, -1F, -1F);
    GL11.glRotatef(rotation, 0F, 1F, 0F);
    model.renderGlass();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glScalef(1F, -1F, -1F);

    renderOverlay((TileRepairer) tileentity, ((TileRepairer) tileentity).tookLastTick ? repair : repairOff,
            1.25F);
    GL11.glPopMatrix();
    GL11.glColor4f(1F, 1F, 1F, 1F);
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glColor3f(float a, float b, float c) {
    GL11.glColor3f(a, b, c);
}

From source file:tk.jacklin213.voxelgale.rendering.BasicRenderer.java

License:Apache License

private void render() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glLoadIdentity();/*from ww w . j a  va  2  s. c  o  m*/

    GL11.glTranslatef(-3f, 0.0f, -20f);
    GL11.glRotatef(45f, 0.4f, 1.0f, 0.1f);
    GL11.glColor3f(0.5f, 0.5f, 1.0f);

    for (int x = 0; x < 3; x++) {
        for (int y = 0; y < 3; y++) {
            for (int z = 0; z < 3; z++) {
                renderCube();
                GL11.glTranslatef(0, 0, 2);
            }
            GL11.glTranslatef(0, 2, -6);
        }
        GL11.glTranslatef(2, -6, 0);
    }
}

From source file:tk.jacklin213.voxelgale.rendering.BasicRenderer.java

License:Apache License

private void renderCube() {
    // Cube GL11.glBegin(GL11.GL_QUADS);
    GL11.glBegin(GL11.GL_LINE_LOOP);// ww w . ja  v  a 2 s.  co  m
    //Bellow code renders the quad
    //Render start
    GL11.glColor3f(1.0f, 1.0f, 0.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);

    GL11.glColor3f(1.0f, 0.5f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);

    GL11.glColor3f(1.0f, 0.0f, 0.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);

    GL11.glColor3f(1.0f, 1.0f, 0.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);

    GL11.glColor3f(0.0f, 0.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(-1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
    GL11.glVertex3f(-1.0f, -1.0f, 1.0f);

    GL11.glColor3f(1.0f, 0.0f, 1.0f);
    GL11.glVertex3f(1.0f, 1.0f, -1.0f);
    GL11.glVertex3f(1.0f, 1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, 1.0f);
    GL11.glVertex3f(1.0f, -1.0f, -1.0f);
    //Render end
    GL11.glEnd();
}