Example usage for org.lwjgl.opengl GL11 glColor3ub

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

Introduction

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

Prototype

public static native void glColor3ub(@NativeType("GLubyte") byte red, @NativeType("GLubyte") byte green,
        @NativeType("GLubyte") byte blue);

Source Link

Document

Unsigned version of #glColor3b Color3b

Usage

From source file:baubles.client.BaublesRenderLayer.java

License:Open Source License

private void dispatchRenders(IBaublesItemHandler inv, EntityPlayer player, RenderType type,
        float partialTicks) {
    for (int i = 0; i < inv.getSlots(); i++) {
        ItemStack stack = inv.getStackInSlot(i);
        if (stack != null) {
            Item item = stack.getItem();
            if (item instanceof IRenderBauble) {
                GlStateManager.pushMatrix();
                GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255);
                GlStateManager.color(1F, 1F, 1F, 1F);
                ((IRenderBauble) stack.getItem()).onPlayerBaubleRender(stack, player, type, partialTicks);
                GlStateManager.popMatrix();
            }//  w w w .j  a  va  2 s  .c  o m
        }
    }
}

From source file:buildcraft.robotics.render.RenderRobot.java

License:Minecraft Mod Public

private void doRenderWearable(EntityRobot entity, TextureManager textureManager, ItemStack wearable) {
    if (wearable.getItem() instanceof IRobotOverlayItem) {
        ((IRobotOverlayItem) wearable.getItem()).renderRobotOverlay(wearable, textureManager);
    } else if (wearable.getItem() instanceof ItemArmor) {
        GL11.glPushMatrix();/*  ww  w.ja  v  a  2 s  .  com*/
        GL11.glScalef(1.0125F, 1.0125F, 1.0125F);
        GL11.glTranslatef(0.0f, -0.25f, 0.0f);
        GL11.glRotatef(180F, 0, 0, 1);

        int color = wearable.getItem().getColorFromItemStack(wearable, 0);
        if (color != 16777215) {
            GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
            GL11.glColor3ub((byte) (color >> 16), (byte) ((color >> 8) & 255), (byte) (color & 255));
        }

        textureManager.bindTexture(RenderBiped.getArmorResource(entity, wearable, 0, null));
        ModelBiped armorModel = ForgeHooksClient.getArmorModel(entity, wearable, 0, null);
        if (armorModel != null) {
            armorModel.render(entity, 0, 0, 0, -90f, 0, 1 / 16F);

            if (color != 16777215) {
                GL11.glPopAttrib();
            }
        } else {
            GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
            helmetBox.render(1 / 16F);

            if (color != 16777215) {
                this.bindTexture(RenderBiped.getArmorResource(entity, wearable, 0, "overlay"));
                helmetBox.render(1 / 16F);
                GL11.glPopAttrib();
            }
        }

        GL11.glPopMatrix();
    } else if (wearable.getItem() instanceof ItemSkull) {
        doRenderSkull(wearable);
    }
}

From source file:cn.liutils.util.RenderUtils.java

License:Open Source License

public static void bindColor(int r, int g, int b) {
    GL11.glColor3ub((byte) r, (byte) g, (byte) b);
}

From source file:cn.liutils.util.RenderUtils.java

License:Open Source License

public static void bindGray(int s) {
    byte r = (byte) s;
    GL11.glColor3ub(r, r, r);
}

From source file:com.professorvennie.machinerycraft.client.gui.GuiBase.java

License:Creative Commons License

public void drawFluid(int x, int y, FluidStack fluid, int width, int height) {
    if (fluid == null || fluid.getFluid() == null)
        return;//from w  ww  .  ja  va  2s  .c o  m
    mc.renderEngine.bindTexture(new ResourceLocation("textures/atlas/blocks.png"));
    GL11.glColor3ub((byte) (fluid.getFluid().getColor() >> 16 & 0xFF),
            (byte) (fluid.getFluid().getColor() >> 8 & 0xFF), (byte) (fluid.getFluid().getColor() & 0xFF));
    drawTiledTexture(x, y, fluid.getFluid().getIcon(fluid), width, height);
}

From source file:game.core.blockmap.BlockMapBehavior.java

License:Open Source License

@Override
public void draw(GameObject target) {
    if (textureProvider == null) {
        return;//from   w w w.jav a  2s  . c  o  m
    }
    int w = Math.min(width, 100);
    int h = Math.min(height, 30);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255);
    for (int x = 0; x < w; x++) {
        for (int y = 0; y < h; y++) {
            Texture texture = textureProvider.getBlockTexture(getBlock(x, y));
            if (texture == null) {
                continue;
            }
            texture.glBindTexture();
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glTexCoord2f(0.0f, 1.0f);
            GL11.glVertex2i(x, y);
            GL11.glTexCoord2f(1.0f, 1.0f);
            GL11.glVertex2i(x + 1, y);
            GL11.glTexCoord2f(1.0f, 0.0f);
            GL11.glVertex2i(x + 1, y + 1);
            GL11.glTexCoord2f(0.0f, 0.0f);
            GL11.glVertex2i(x, y + 1);
            GL11.glEnd();
        }
    }
}

From source file:game.engine.gfx.RgbColor.java

License:Open Source License

/**
 * Configures this color using glColor().
 *///from   w w  w .j a  v  a  2s . co m
public void glColor() {
    GL11.glColor3ub((byte) r, (byte) g, (byte) b);
}

From source file:game.engine.gfx.Sprite.java

License:Open Source License

/**
 * Draws this sprite at the current origin.
 *///from w  w w  . ja  va2s .  c o  m
public void draw() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    glBindTexture();
    GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255);
    GL11.glBegin(GL11.GL_QUADS);
    glVertices();
    GL11.glEnd();
}

From source file:hexagonalminesweeper.HexagonalMinesweeper.java

public static void Colour(int index) {

    if (index == -3) {
        GL11.glColor3ub((byte) 255, (byte) 255, (byte) 0); //yellow;
    }/*from   ww  w . j av a 2 s. com*/
    if (index == -2) {
        GL11.glColor3ub((byte) 55, (byte) 55, (byte) 55); //gray
    }
    if (index == -1) {
        GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255); //white
    }
    if (index == 0) {

        GL11.glColor3ub((byte) 0, (byte) 0, (byte) 0);
    }
    if (index == 1) {

        GL11.glColor3ub((byte) 139, (byte) 69, (byte) 19);

    }
    if (index == 2) {
        GL11.glColor3ub((byte) 0, (byte) 128, (byte) 0);

    }
    if (index == 3) {
        GL11.glColor3ub((byte) 0, (byte) 0, (byte) 255);

    }
    if (index == 4) {
        GL11.glColor3ub((byte) 128, (byte) 0, (byte) 128);

    }
    if (index == 5) {

        GL11.glColor3ub((byte) 255, (byte) 0, (byte) 0);
    }
    if (index == 6) {

        GL11.glColor3ub((byte) 0, (byte) 255, (byte) 255);
    }
}

From source file:hexagonalminesweeper.HexagonalMinesweeper.java

public static void checkWinLose() {

    int correct = 0;

    if (vertexUpwards) {

        for (int xi = 0; xi < 200; xi++) {

            for (int yi = 0; yi < 100; yi++) {

                if (covered && selectedHexagons[xi][yi] == 1 && (values1[xi][yi] == -1)) {
                    uncover();//  ww w  .j a va2 s  .co  m
                    GL11.glColor3ub((byte) 50, (byte) 0, (byte) 0);
                    GL11.glBegin(GL11.GL_QUADS);
                    GL11.glVertex2f(0, 0);
                    GL11.glVertex2f(800, 0);
                    GL11.glVertex2f(800, 600);
                    GL11.glVertex2f(0, 600);
                    GL11.glEnd();

                    if (timerStart == 2) {
                        savedTime = (int) (time - initialTime);
                    }
                    timerStart = 3;
                }

                if (flagNumber == mineNumber && selectedHexagons[xi][yi] == 2 && values1[xi][yi] == -1) {
                    correct++;
                }

            }
        }
        if (mineNumber != 0 && correct == mineNumber) {

            GL11.glColor3ub((byte) 0, (byte) 50, (byte) 0);
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glVertex2f(0, 0);
            GL11.glVertex2f(800, 0);
            GL11.glVertex2f(800, 600);
            GL11.glVertex2f(0, 600);
            GL11.glEnd();

            if (timerStart == 2) {
                savedTime = (int) (time - initialTime);
            }
            timerStart = 3;
        }
    } else {
        for (int xi = 0; xi < 200; xi++) {

            for (int yi = 0; yi < 100; yi++) {

                if (covered && selectedHexagons[xi][yi] == 1 && values2[xi][yi] == -1) {
                    uncover();
                    GL11.glColor3ub((byte) 50, (byte) 0, (byte) 0);
                    GL11.glBegin(GL11.GL_QUADS);
                    GL11.glVertex2f(0, 0);
                    GL11.glVertex2f(800, 0);
                    GL11.glVertex2f(800, 600);
                    GL11.glVertex2f(0, 600);
                    GL11.glEnd();

                    if (timerStart == 2) {
                        savedTime = (int) (time - initialTime);
                    }
                    timerStart = 3;
                }

                if (flagNumber == mineNumber && selectedHexagons[xi][yi] == 2 && values2[xi][yi] == -1) {
                    correct++;
                }

            }
        }
        if (mineNumber != 0 && correct == mineNumber) {

            GL11.glColor3ub((byte) 0, (byte) 50, (byte) 0);
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glVertex2f(0, 0);
            GL11.glVertex2f(800, 0);
            GL11.glVertex2f(800, 600);
            GL11.glVertex2f(0, 600);
            GL11.glEnd();

            if (timerStart == 2) {
                savedTime = (int) (time - initialTime);
            }
            timerStart = 3;
        }

    }
}