Example usage for org.lwjgl.opengl GL11 glColor4d

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

Introduction

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

Prototype

public static native void glColor4d(@NativeType("GLdouble") double red, @NativeType("GLdouble") double green,
        @NativeType("GLdouble") double blue, @NativeType("GLdouble") double alpha);

Source Link

Document

Double version of #glColor4b Color4b

Usage

From source file:cn.liutils.cgui.gui.LIGui.java

License:Open Source License

private void drawTraverse(double mx, double my, Widget cur, WidgetContainer set, Widget top) {
    try {//from  ww w . j a va  2  s.  c om
        if (cur != null && cur.isVisible()) {
            GL11.glPushMatrix();
            GL11.glTranslated(cur.x, cur.y, 0);

            double px = cur.transform.pivotX * cur.scale, py = cur.transform.pivotY * cur.scale;

            GL11.glScaled(cur.scale, cur.scale, 1);
            GL11.glTranslated(-cur.transform.pivotX, -cur.transform.pivotY, 0);

            GL11.glColor4d(1, 1, 1, 1); //Force restore color for any widget
            cur.postEvent(new FrameEvent((mx - cur.x) / cur.scale, (my - cur.y) / cur.scale, cur == top));
            GL11.glPopMatrix();
        }
    } catch (Exception e) {
        LIUtils.log.error("Error occured handling widget draw. instance class: " + cur.getClass().getName()
                + ", name: " + cur.getName());
        e.printStackTrace();
    }

    if (cur == null || cur.isVisible()) {
        Iterator<Widget> iter = set.iterator();
        while (iter.hasNext()) {
            Widget wn = iter.next();
            drawTraverse(mx, my, wn, wn, top);
        }
    }
}

From source file:cn.liutils.cgui.loader.ui.SaveAsScreen.java

License:Open Source License

private void addWidgets() {
    Widget tb = new Widget();
    tb.transform.setPos(10, 15).setSize(80, 10);

    DrawTexture drawer = new DrawTexture();
    drawer.setTex(null).setColor4d(1, 1, 1, 0.3);
    tb.addComponent(drawer);// w  w w  .  j av a 2 s.  c om

    textBox = new TextBox();
    textBox.content = "cgui/unnamed_0.xml";
    textBox.size = 9;
    tb.addComponent(textBox);
    addWidget(tb);

    Widget button = new Widget();
    button.transform.setSize(18, 8).setPos(41, 30);

    Tint tint = new Tint();
    tint.idleColor = new Color(1, 1, 1, 0.3);
    button.addComponent(tint);

    button.regEventHandler(new MouseDownHandler() {
        @Override
        public void handleEvent(Widget w, MouseDownEvent event) {
            File file = new File(textBox.content);
            if (file.exists()) {
                lastWarningTime = GameTimer.getAbsTime();
            } else {
                if (!CGUIDocWriter.save(guiEdit.toEdit, file))
                    Minecraft.getMinecraft().thePlayer
                            .sendChatMessage(CGUILang.commSaveFailed() + textBox.content);
                else
                    Minecraft.getMinecraft().thePlayer.sendChatMessage(CGUILang.commSaved() + textBox.content);
                guiEdit.path = textBox.content;
                SaveAsScreen.this.dispose();
            }
        }
    });

    button.regEventHandler(new FrameEventHandler() {
        @Override
        public void handleEvent(Widget w, FrameEvent event) {
            Font.font.draw(CGUILang.butSave(), 9, 1, 6, 0xffffff, Align.CENTER);
            if (GameTimer.getAbsTime() - lastWarningTime < 1000L) {
                GL11.glColor4d(1, .3, .3, .3);
                HudUtils.colorRect(0, 0, w.transform.width, w.transform.height);
                GL11.glColor4d(1, 1, 1, 1);
            }
        }
    });

    addWidget(button);
}

From source file:cn.liutils.cgui.utils.Color.java

License:Open Source License

public void bind() {
    GL11.glColor4d(r, g, b, a);
}

From source file:cn.liutils.util.helper.Color.java

License:Open Source License

@SideOnly(Side.CLIENT)
public void bind() {
    //System.out.println("BIND " + r + " " + g + " " + b + " " + a);
    GL11.glColor4d(r, g, b, a);
}

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

License:Open Source License

public static void bindGray(double s, double alpha) {
    GL11.glColor4d(s, s, s, alpha);
}

From source file:cn.weaponry.impl.classic.client.animation.Muzzleflash.java

License:Open Source License

@Override
public void render(ItemInfo info, PartedModel model, boolean firstPerson) {
    double alpha = 1.0;

    if (texture == null && textures != null) {
        texture = textures[RandUtils.nextInt(textures.length)];
    }/*from w w w.  j av  a  2s.  c  o m*/

    //Blend in
    long dt = getTime();
    if (dt < 40) {
        alpha = dt / 40.0;
    } else if (dt > lifeTime - 40.0) {
        alpha = (lifeTime - dt) / 40.0;
    }

    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glPushMatrix();
    RenderUtils.loadTexture(texture == null ? MISSING : texture);
    GL11.glTranslated(x, y, z);

    material.setTexture(texture);
    GL11.glScaled(size, size, size);
    material.color.a = alpha * 0.8;
    GL11.glRotatef(90, 0, 1, 0);
    mesh.draw(material);
    GL11.glColor4d(1, 1, 1, 1);

    GL11.glPopMatrix();
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:com.bluepowermod.client.gui.widget.BaseWidget.java

License:Open Source License

@Override
public void render(int mouseX, int mouseY) {

    if (enabled) {
        GL11.glColor4d(1, 1, 1, 1);
    } else {/*w  ww  .  j a v  a  2s .  c  om*/
        GL11.glColor4d(0.2, 0.2, 0.2, 1);
    }
    if (textures.length > 0)
        Minecraft.getMinecraft().getTextureManager().bindTexture(textures[textureIndex]);
    Gui.func_146110_a(x, y, getTextureU(), getTextureV(), width, height, getTextureWidth(), getTextureHeight());
}

From source file:com.bluepowermod.client.gui.widget.WidgetColor.java

License:Open Source License

@Override
public void render(int mouseX, int mouseY) {

    super.render(mouseX, mouseY);
    if (value < 16) {
        Gui.drawRect(x + 5, y + 5, x + 9, y + 9, 0xFF000000 + ItemDye.field_150922_c[value]);
        GL11.glColor4d(1, 1, 1, 1);
    }/*from  w w  w . j  av  a  2  s  .  c  om*/
}

From source file:com.bluepowermod.client.gui.widget.WidgetSidewaysTab.java

License:Open Source License

@Override
public void render(int mouseX, int mouseY) {

    if (textures.length > 0)
        Minecraft.getMinecraft().getTextureManager().bindTexture(textures[0]);

    for (int i = 0; i < tabAmount; i++) {
        if (i == value) {
            GL11.glColor4d(1, 1, 1, 1);
        } else {//from   ww w .j  av  a 2s  .c o m
            if (enabledTabs[i]) {
                GL11.glColor4d(0.6, 0.6, 0.6, 1);
            } else {
                GL11.glColor4d(0.2, 0.2, 0.2, 1);
            }
        }
        Gui.func_146110_a(x + singleTabWidth * i, y, getTextureU(), getTextureV() + singleTabWidth * i,
                singleTabWidth, height, 256, 256);
    }
}

From source file:com.bluepowermod.client.gui.widget.WidgetTab.java

License:Open Source License

@Override
public void render(int mouseX, int mouseY) {

    if (textures.length > 0)
        Minecraft.getMinecraft().getTextureManager().bindTexture(textures[0]);

    for (int i = 0; i < tabAmount; i++) {
        if (i == value) {
            GL11.glColor4d(1, 1, 1, 1);
        } else {/*www.  j  a va 2s  .  c om*/
            if (enabledTabs[i]) {
                GL11.glColor4d(0.6, 0.6, 0.6, 1);
            } else {
                GL11.glColor4d(0.2, 0.2, 0.2, 1);
            }
        }
        Gui.func_146110_a(x, y + singleTabHeight * i, getTextureU(), getTextureV() + singleTabHeight * i, width,
                singleTabHeight, 256, 256);
    }
}