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:kuake2.render.lwjgl.Light.java

License:Open Source License

/**
 * R_RenderDlights/*from   www  .  ja  va 2s.  c  o m*/
 */
void R_RenderDlights() {
    if (gl_flashblend.value == 0)
        return;

    r_dlightframecount = r_framecount + 1; // because the count hasn't
    //  advanced yet for this frame
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);

    for (int i = 0; i < r_newrefdef.num_dlights; i++) {
        R_RenderDlight(r_newrefdef.dlights[i]);
    }

    GL11.glColor3f(1, 1, 1);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(true);
}

From source file:kuake2.render.lwjgl.Main.java

License:Open Source License

/**
 * R_DrawNullModel//from   w  w  w .  j  a  v a  2s  . c o m
 */
void R_DrawNullModel() {
    if ((currententity.flags & Defines.RF_FULLBRIGHT) != 0) {
        // cwei wollte blau: shadelight[0] = shadelight[1] = shadelight[2] = 1.0F;
        shadelight[0] = shadelight[1] = shadelight[2] = 0.0F;
        shadelight[2] = 0.8F;
    } else {
        R_LightPoint(currententity.origin, shadelight);
    }

    GL11.glPushMatrix();
    R_RotateForEntity(currententity);

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(shadelight[0], shadelight[1], shadelight[2]);

    // this replaces the TRIANGLE_FAN
    //glut.glutWireCube(gl, 20);

    GL11.glBegin(GL11.GL_TRIANGLE_FAN);
    GL11.glVertex3f(0, 0, -16);
    int i;
    for (i = 0; i <= 4; i++) {
        GL11.glVertex3f((float) (16.0f * Math.cos(i * Math.PI / 2)),
                (float) (16.0f * Math.sin(i * Math.PI / 2)), 0.0f);
    }
    GL11.glEnd();

    GL11.glBegin(GL11.GL_TRIANGLE_FAN);
    GL11.glVertex3f(0, 0, 16);
    for (i = 4; i >= 0; i--) {
        GL11.glVertex3f((float) (16.0f * Math.cos(i * Math.PI / 2)),
                (float) (16.0f * Math.sin(i * Math.PI / 2)), 0.0f);
    }
    GL11.glEnd();

    GL11.glColor3f(1, 1, 1);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:kuake2.render.lwjgl.Surf.java

License:Open Source License

/**
 * R_DrawBrushModel/*from   w  w w  .  ja va  2  s  . co  m*/
 */
void R_DrawBrushModel(entity_t e) {
    if (currentmodel.nummodelsurfaces == 0)
        return;

    currententity = e;
    gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;

    boolean rotated;
    if (e.angles[0] != 0 || e.angles[1] != 0 || e.angles[2] != 0) {
        rotated = true;
        for (int i = 0; i < 3; i++) {
            mins[i] = e.origin[i] - currentmodel.radius;
            maxs[i] = e.origin[i] + currentmodel.radius;
        }
    } else {
        rotated = false;
        Math3D.VectorAdd(e.origin, currentmodel.mins, mins);
        Math3D.VectorAdd(e.origin, currentmodel.maxs, maxs);
    }

    if (R_CullBox(mins, maxs))
        return;

    GL11.glColor3f(1, 1, 1);

    // memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));

    // TODO wird beim multitexturing nicht gebraucht
    //gl_lms.clearLightmapSurfaces();

    Math3D.VectorSubtract(r_newrefdef.vieworg, e.origin, modelorg);
    if (rotated) {
        Math3D.VectorCopy(modelorg, org);
        Math3D.AngleVectors(e.angles, forward, right, up);
        modelorg[0] = Math3D.DotProduct(org, forward);
        modelorg[1] = -Math3D.DotProduct(org, right);
        modelorg[2] = Math3D.DotProduct(org, up);
    }

    GL11.glPushMatrix();

    e.angles[0] = -e.angles[0]; // stupid quake bug
    e.angles[2] = -e.angles[2]; // stupid quake bug
    R_RotateForEntity(e);
    e.angles[0] = -e.angles[0]; // stupid quake bug
    e.angles[2] = -e.angles[2]; // stupid quake bug

    GL_EnableMultitexture(true);
    GL_SelectTexture(GL_TEXTURE0);
    GL_TexEnv(GL11.GL_REPLACE);
    GL11.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf);
    GL_SelectTexture(GL_TEXTURE1);
    GL_TexEnv(GL11.GL_MODULATE);
    GL11.glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    R_DrawInlineBModel();

    ARBMultitexture.glClientActiveTextureARB(GL_TEXTURE1);
    GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    GL_EnableMultitexture(false);

    GL11.glPopMatrix();
}

From source file:kuake2.render.lwjgl.Surf.java

License:Open Source License

/**
 * R_DrawWorld//  w w  w.  j a  va 2 s  . c o  m
 */
void R_DrawWorld() {
    if (r_drawworld.value == 0)
        return;

    if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0)
        return;

    currentmodel = r_worldmodel;

    Math3D.VectorCopy(r_newrefdef.vieworg, modelorg);

    entity_t ent = worldEntity;
    // auto cycle the world frame for texture animation
    ent.clear();
    ent.frame = (int) (r_newrefdef.time * 2);
    currententity = ent;

    gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;

    GL11.glColor3f(1, 1, 1);
    // memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
    // TODO wird bei multitexture nicht gebraucht
    //gl_lms.clearLightmapSurfaces();

    R_ClearSkyBox();

    GL_EnableMultitexture(true);

    GL_SelectTexture(GL_TEXTURE0);
    GL_TexEnv(GL11.GL_REPLACE);
    GL11.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf);
    GL_SelectTexture(GL_TEXTURE1);
    GL11.glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    if (gl_lightmap.value != 0)
        GL_TexEnv(GL11.GL_REPLACE);
    else
        GL_TexEnv(GL11.GL_MODULATE);

    R_RecursiveWorldNode(r_worldmodel.nodes[0]); // root node

    ARBMultitexture.glClientActiveTextureARB(GL_TEXTURE1);
    GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    GL_EnableMultitexture(false);

    DrawTextureChains();
    R_DrawSkyBox();
    R_DrawTriangleOutlines();
}

From source file:lwjgl29.GlobalClass.Quad.java

@Override
public void draw() {
    GL11.glColor3f(this.r, this.g, this.b);
    GL11.glBegin(GL11.GL_POLYGON);/*from  ww  w .j a  v a2  s  .c  o  m*/
    //position de dpart
    GL11.glVertex2f(this.x, this.y);
    //dessin des 3 cots
    GL11.glVertex2f(this.x + this.width, this.y);
    GL11.glVertex2f(this.x + this.width, this.y + this.height);
    GL11.glVertex2f(this.x, this.y + this.height);
    GL11.glEnd();
    this.move();
}

From source file:lyonlancer5.pfsteel.world.dimension.yakusoku.YakusokuSkyRenderer.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)/*from  w  w w .j  a va 2  s  .  c om*/
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks);
    float f1 = (float) vec3.xCoord;
    float f2 = (float) vec3.yCoord;
    float f3 = (float) vec3.zCoord;
    float f4;
    if (mc.gameSettings.anaglyph) {
        float f5 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
        float f6 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
        f4 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
        f1 = f5;
        f2 = f6;
        f3 = f4;
    }
    GL11.glColor3f(f1, f2, f3);
    Tessellator tessellator1 = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(f1, f2, f3);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.disableStandardItemLighting();
    float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks),
            partialTicks);
    float f7;
    float f8;
    float f9;
    float f10;
    if (afloat != null) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glPushMatrix();
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F,
                0.0F, 0.0F, 1.0F);
        GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
        f4 = afloat[0];
        f7 = afloat[1];
        f8 = afloat[2];
        float f11;
        if (mc.gameSettings.anaglyph) {
            f9 = (f4 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
            f10 = (f4 * 30.0F + f7 * 70.0F) / 100.0F;
            f11 = (f4 * 30.0F + f8 * 70.0F) / 100.0F;
            f4 = f9;
            f7 = f10;
            f8 = f11;
        }
        tessellator1.startDrawing(6);
        tessellator1.setColorRGBA_F(f4, f7, f8, afloat[3]);
        tessellator1.addVertex(0.0D, 100.0D, 0.0D);
        byte b0 = 16;
        tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F);
        for (int j = 0; j <= b0; ++j) {
            f11 = (float) j * (float) Math.PI * 2.0F / (float) b0;
            float f12 = MathHelper.sin(f11);
            float f13 = MathHelper.cos(f11);
            tessellator1.addVertex((double) (f12 * 120.0F), (double) (f13 * 120.0F),
                    (double) (-f13 * 40.0F * afloat[3]));
        }
        tessellator1.draw();
        GL11.glPopMatrix();
        GL11.glShadeModel(GL11.GL_FLAT);
    }
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glPushMatrix();
    f4 = 1.0F - world.getRainStrength(partialTicks);
    f7 = 0.0F;
    f8 = 0.0F;
    f9 = 0.0F;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, f4);
    GL11.glTranslatef(f7, f8, f9);
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);

    f10 = 20.0F; // Size of sun from center
    mc.renderEngine
            .bindTexture(new ResourceLocation(ModVersion.modid, "textures/environment/yakusoku_sun.png"));

    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV((double) (-f10), 100.0D, (double) (-f10), 0.0D, 0.0D);
    tessellator1.addVertexWithUV((double) f10, 100.0D, (double) (-f10), 1.0D, 0.0D);
    tessellator1.addVertexWithUV((double) f10, 100.0D, (double) f10, 1.0D, 1.0D);
    tessellator1.addVertexWithUV((double) (-f10), 100.0D, (double) f10, 0.0D, 1.0D);

    tessellator1.draw(); // Draw sun
    f10 = 15.0F; // Size of moon from center

    mc.renderEngine.bindTexture(
            new ResourceLocation(ModVersion.modid, "textures/environment/yakusoku_moon_phases.png"));

    int k = world.getMoonPhase();
    int l = k % 4;
    int i1 = k / 4 % 2;
    float f14 = (float) (l + 0) / 4.0F;
    float f15 = (float) (i1 + 0) / 2.0F;
    float f16 = (float) (l + 1) / 4.0F;
    float f17 = (float) (i1 + 1) / 2.0F;
    tessellator1.startDrawingQuads();
    tessellator1.addVertexWithUV((double) (-f10), -100.0D, (double) f10, (double) f16, (double) f17);
    tessellator1.addVertexWithUV((double) f10, -100.0D, (double) f10, (double) f14, (double) f17);
    tessellator1.addVertexWithUV((double) f10, -100.0D, (double) (-f10), (double) f14, (double) f15);
    tessellator1.addVertexWithUV((double) (-f10), -100.0D, (double) (-f10), (double) f16, (double) f15);
    tessellator1.draw();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    float f18 = world.getStarBrightness(partialTicks) * f4;
    if (f18 > 0.0F) {
        GL11.glColor4f(f18, f18, f18, f18);
        GL11.glCallList(this.starGLCallList);
    }
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon();
    if (d0 < 0.0D) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 12.0F, 0.0F);
        GL11.glCallList(this.glSkyList2);
        GL11.glPopMatrix();
        f8 = 1.0F;
        f9 = -((float) (d0 + 65.0D));
        f10 = -f8;
        tessellator1.startDrawingQuads();
        tessellator1.setColorRGBA_I(0, 255);
        tessellator1.addVertex((double) (-f8), (double) f9, (double) f8);
        tessellator1.addVertex((double) f8, (double) f9, (double) f8);
        tessellator1.addVertex((double) f8, (double) f10, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f10, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f9, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f9, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f10, (double) (-f8));
        tessellator1.addVertex((double) f8, (double) f10, (double) f8);
        tessellator1.addVertex((double) f8, (double) f9, (double) f8);
        tessellator1.addVertex((double) f8, (double) f9, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f9, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f9, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) f8);
        tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f10, (double) (-f8));
        tessellator1.addVertex((double) (-f8), (double) f10, (double) f8);
        tessellator1.addVertex((double) f8, (double) f10, (double) f8);
        tessellator1.addVertex((double) f8, (double) f10, (double) (-f8));
        tessellator1.draw();
    }
    if (world.provider.isSkyColored()) {
        GL11.glColor3f(0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
        //GL11.glColor3f(0.2F + 0.04F, f2 * 0.6F + 0.1F, f3 * 0.2F + 0.04F);
    } else {
        GL11.glColor3f(f1, f2, f3);
    }
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
}

From source file:Main.Graphics.GameObject.java

public static void RenderGL() {

    float x = GameWorld.x;
    float y = GameWorld.y;
    float rotation = GameWorld.rotation;

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    GL11.glColor3f(0.5f, 0.5f, 1.0f);

    GL11.glPushMatrix();//from   w  w  w . j a  v  a2  s  .c o  m
    GL11.glTranslatef(x, y, 0);
    GL11.glRotatef(rotation, 0f, 0f, 1f);
    GL11.glTranslatef(-x, -y, 0);

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(x - 50, y - 50);
    GL11.glVertex2f(x + 50, y - 50);
    GL11.glVertex2f(x + 50, y + 50);
    GL11.glVertex2f(x - 50, y + 50);
    GL11.glEnd();
    GL11.glPopMatrix();

}

From source file:makeo.gadomancy.client.renderers.entity.RenderGolemHelper.java

License:LGPL

public static void renderCarriedItemsFix(EntityGolemBase golem) {
    GL11.glPushMatrix();//from   w  w  w .  j  av  a2 s  .  c o m

    GL11.glScaled(0.4D, 0.4D, 0.4D);

    GL11.glTranslatef(-0.5F, 2.5F, -1.25F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);

    ItemStack item = golem.getCarriedForDisplay();

    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());

            ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(),
                    icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }
        renderPass++;
    } while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));

    GL11.glPopMatrix();
}

From source file:map.Base.java

License:Open Source License

public void draw(GameMap map) {
    if (!isAlive()) {
        return;/*from   w w  w. ja v  a  2  s  . co m*/
    }
    if (owner == null) {
        GL11.glColor3f(1.0f, 1.0f, 1.0f);
    } else {
        Color playerColour = owner.getColour();
        GL11.glColor3f(playerColour.getRed() / 255.0f, playerColour.getGreen() / 255.0f,
                playerColour.getBlue() / 255.0f);
    }

    skin.bind();

    GL11.glPushMatrix();
    GL11.glTranslatef(pos.x, pos.y, pos.z);
    model.draw(state);
    //        shell.draw();
    GL11.glPopMatrix();
}

From source file:matteroverdrive.gui.element.ElementBaseGroup.java

License:Open Source License

@Override
public void drawBackground(int mouseX, int mouseY, float gameTicks) {
    mouseX -= posX;/*from   w  w  w .  j  a va 2 s .co m*/
    mouseY -= posY;

    GL11.glPushMatrix();
    GL11.glTranslatef(this.posX, this.posY, 0);
    GL11.glColor3f(1, 1, 1);
    for (int i = getElements().size(); i-- > 0;) {
        MOElementBase c = getElements().get(i);

        if (c.isVisible())
            c.drawBackground(mouseX, mouseY, gameTicks);
    }
    GL11.glPopMatrix();
}