Example usage for org.lwjgl.opengl GL11 glColor4f

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

Introduction

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

Prototype

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

Source Link

Document

Float version of #glColor4b Color4b

Usage

From source file:Robot.java

private void drawLeftThigh() {
    GL11.glColor4f(robotColor[0], robotColor[1], robotColor[2], 1);
    if (selected.get("LEFT_THIGH")) {
        DrawShapes.fillRectangle(0, 0, THIGH_WIDTH, -THIGH_HEIGHT);
    } else {/*  w w w.  j av  a2 s. c om*/
        DrawShapes.strokeRectangle(0, 0, THIGH_WIDTH, -THIGH_HEIGHT);
    }
}

From source file:Robot.java

private void drawRightCalf() {
    GL11.glColor4f(robotColor[0], robotColor[1], robotColor[2], 1);
    if (selected.get("RIGHT_CALF")) {
        DrawShapes.fillRectangle(0, 0, CALF_WIDTH, -CALF_HEIGHT);
    } else {/* w w w . j  av a  2s.co m*/
        DrawShapes.strokeRectangle(0, 0, CALF_WIDTH, -CALF_HEIGHT);
    }
}

From source file:Robot.java

private void drawLeftCalf() {
    GL11.glColor4f(robotColor[0], robotColor[1], robotColor[2], 1);
    if (selected.get("LEFT_CALF")) {
        DrawShapes.fillRectangle(0, 0, CALF_WIDTH, -CALF_HEIGHT);
    } else {//from www  .  ja v a 2 s  . co m
        DrawShapes.strokeRectangle(0, 0, CALF_WIDTH, -CALF_HEIGHT);
    }
}

From source file:$.DrawSystem.java

License:Open Source License

private void drawSprite(Sprite sprite) {
        Vector pos = spriteProjector.project(sprite.getPosition());
        final IPlay play = sprite.getPlay();
        if (null != play) {
            GL11.glPushMatrix();/*from   w w  w.jav  a 2s . c om*/
            GL11.glTranslatef(pos.x, pos.y, 0.0f);
            GL11.glRotatef(sprite.getRotate(), 0, 0, 1.0f);
            GL11.glScalef(sprite.getScale(), sprite.getScale(), 1);
            final IAnimationFrame frame = play.getCurrentFrame();
            final IAnimationImage image = frame.getImage();
            if (image.hasAlpha()) {
                GL11.glEnable(GL11.GL_BLEND);
            }
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, (Integer) image.getId());

            final float u1, u2;
            if (sprite.isMirrorX()) {
                u1 = frame.getU2();
                u2 = frame.getU1();
            } else {
                u1 = frame.getU1();
                u2 = frame.getU2();
            }

            final float v1, v2;
            if (sprite.isMirrorY()) {
                v1 = frame.getV1();
                v2 = frame.getV2();
            } else {
                v1 = frame.getV2();
                v2 = frame.getV1();
            }
            GL11.glColor4f(sprite.getRed(), sprite.getGreen(), sprite.getBlue(), sprite.getAlpha());
            float x1 = -sprite.getWidth() / 2.0f;
            float x2 = sprite.getWidth() / 2.0f;
            float y1 = -sprite.getHeight() / 2.0f;
            float y2 = sprite.getHeight() / 2.0f;
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glTexCoord2f(u1, v1);
            GL11.glVertex2f(x1, y2);
            GL11.glTexCoord2f(u2, v1);
            GL11.glVertex2f(x2, y2);
            GL11.glTexCoord2f(u2, v2);
            GL11.glVertex2f(x2, y1);
            GL11.glTexCoord2f(u1, v2);
            GL11.glVertex2f(x1, y1);
            GL11.glEnd();
            GL11.glColor3f(1f, 1f, 1f);
            if (image.hasAlpha()) {
                GL11.glDisable(GL11.GL_BLEND);
            }
            GL11.glPopMatrix();
        }
        if (null != sprite.getLabel()) {
            GL11.glPushMatrix();
            GL11.glTranslatef(pos.x, pos.y, 0.0f);
            GL11.glScalef(0.5f, -0.5f, 1f);
            GL11.glEnable(GL11.GL_BLEND);
            LwjglNuitFont font = (LwjglNuitFont) assets.getFont("");
            font.drawString(sprite.getLabel(), LwjglNuitFont.Align.CENTER);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glPopMatrix();
        }
    }

From source file:a1.gui.GUI_Map.java

License:Open Source License

public void DrawTiles() {
    int x, y, i;/* www  .  j a v  a2 s .c  om*/
    int stw, sth;
    Coord oc, tc, ctc, sc;

    RenderedTiles = 0;
    Render2D.ChangeColor();
    Sprite.setStaticColor();

    //   ? ?
    stw = (TILE_SIZE * 4) - 2;
    sth = TILE_SIZE * 2;
    // ?  ?
    Coord sz = scaled_size;
    oc = viewoffset(sz, mc);
    //   ? ?
    tc = mc.div(TILE_SIZE);
    tc.x += -(sz.x / (2 * stw)) - (sz.y / (2 * sth)) - 2;
    tc.y += (sz.x / (2 * stw)) - (sz.y / (2 * sth));

    if (needUpdateView) {

        needUpdateView = false;

        for (y = 0; y < (sz.y / sth) + 13; y++) {
            for (x = 0; x < (sz.x / stw) + 3; x++) {
                for (i = 0; i < 2; i++) {
                    //   
                    ctc = tc.add(new Coord(x + y, y - x + i));
                    // ?  
                    sc = m2s(ctc.mul(TILE_SIZE)).add(oc);
                    sc.x -= TILE_SIZE * 2;
                    //  
                    //    ? 
                    drawtile(ctc, sc);
                }
            }
        }

        // ?   ? 
        if (Config.tile_grid) {
            for (y = 0; y < (sz.y / sth) + 2; y++) {
                for (x = 0; x < (sz.x / stw) + 3; x++) {
                    for (i = 0; i < 2; i++) {
                        ctc = tc.add(new Coord(x + y, -x + y + i));
                        sc = m2s(ctc.mul(TILE_SIZE)).add(oc);
                        drawtile_grid(sc);
                    }
                }
            }
        }

        if (render_claims) {
            Color col;
            for (ClaimPersonal claim : Claims.claims.values()) {

                if (Player.CharID == claim.owner_id) {
                    col = new Color(0f, 1f, 1f, 0.25f);
                    //                  if (Claims.expand_claim != null)
                    //                     continue;
                } else
                    col = new Color(1f, 0f, 0f, 0.25f);

                putClaim(claim, oc, col);
            }

            if (Claims.expand_claim != null) {
                col = new Color(0f, 0f, 0.8f, 0.17f);

                putClaim(Claims.expand_claim, oc, col);
            }
        }

        //
        updateVBO();
    }

    Color.white.bind();
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, tile_vbo);
    GL11.glVertexPointer(2, GL11.GL_FLOAT, 16, 0L);
    GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 16, 8L);

    Resource.textures.get("tiles").bind();

    GL11.glDrawArrays(GL11.GL_QUADS, 0, tile_drawCount);

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
    GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    if (render_claims) {
        GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
        GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, claim_vbo);
        GL11.glColorPointer(4, GL11.GL_FLOAT, 24, 0L);
        GL11.glVertexPointer(2, GL11.GL_FLOAT, 24, 16L);
        GL11.glDrawArrays(GL11.GL_QUADS, 0, claim_drawCount);
        GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
    }

    if (Config.tile_grid) {
        GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
        GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, tileGrid_vbo);
        GL11.glVertexPointer(2, GL11.GL_FLOAT, 0, 0L);
        GL11.glDrawArrays(GL11.GL_LINES, 0, tileGrid_drawCount);
    }

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);

}

From source file:a1.gui.GUI_Map.java

License:Open Source License

public void RenderLightMap() {
    GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_SRC_COLOR);
    //Log.info("lightmap: "+LightMap);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, LightMap); //Resource.textures.get("core_skin").getTextureID());

    GL11.glTranslatef(0, 0, 0);/*from  www.  jav  a 2 s.c o  m*/
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

    float texwidth = 1024;
    float texheight = 1024;

    float newTextureOffsetX = 0 / texwidth;
    float newTextureOffsetY = 0 / texheight;
    float newTextureWidth = 1024 / texwidth;
    float newTextureHeight = 1024 / texheight;

    int w = 1024;
    int h = 1024;

    GL11.glBegin(GL11.GL_QUADS);
    {
        glTexCoord2f(newTextureOffsetX, newTextureOffsetY);
        glVertex2i(0, 0);

        glTexCoord2f(newTextureOffsetX, newTextureOffsetY + newTextureHeight);
        glVertex2i(0, h);

        glTexCoord2f(newTextureOffsetX + newTextureWidth, newTextureOffsetY + newTextureHeight);
        glVertex2i(w, h);

        glTexCoord2f(newTextureOffsetX + newTextureWidth, newTextureOffsetY);
        glVertex2i(w, 0);
    }

    GL11.glEnd();

    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}

From source file:a1.Render2D.java

License:Open Source License

static public void GLColor() {
    GL11.glColor4f(col.r, col.g, col.b, col.a);
}

From source file:abo.pipes.fluids.gui.GuiPipeFluidsDiamond.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(TEXTURE);

    int cornerX = (width - xSize) / 2;
    int cornerY = (height - ySize) / 2;
    drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);

    drawBackgroundSlots();/*from w  w w .  j a  v a2s .  com*/
}

From source file:abo.pipes.liquids.gui.GuiPipeLiquidsDiamond.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture("/gfx/abo/gui/pipeLiquidsDiamond.png");

    int cornerX = (width - xSize) / 2;
    int cornerY = (height - ySize) / 2;
    drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);

    drawBackgroundSlots();//  w  w  w. j a  v  a2 s . co  m
}

From source file:abo.pipes.power.gui.GuiPipePowerDiamond.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(TEXTURE);

    int cornerX = (width - xSize) / 2;
    int cornerY = (height - ySize) / 2;
    drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);

    for (AdvancedSlot slot : slots) {
        if (slot instanceof YesNoSlot) {
            YesNoSlot s = (YesNoSlot) slot;
            drawTexturedModalRect(cornerX + slot.x, cornerY + slot.y, 240, s.isYes() ? 0 : 16, 16, 16);
        }/*w w  w. j a va  2  s .  co m*/
    }
}