Example usage for org.lwjgl.opengl GL11 GL_FLAT

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

Introduction

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

Prototype

int GL_FLAT

To view the source code for org.lwjgl.opengl GL11 GL_FLAT.

Click Source Link

Document

ShadingModel

Usage

From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java

License:Open Source License

void dsDrawTriangle(final float[] pos, final float[] R, final float[] vAll, final int v0, final int v1,
        final int v2, boolean solid) {
    if (current_state != 2)
        dsError("drawing function called outside simulation loop");
    setupDrawingMode();//  ww  w . j a  v a 2s.  com
    GL11.glShadeModel(GL11.GL_FLAT);
    setTransform(pos, R);
    drawTriangle(vAll, v0, v1, v2, solid);
    GL11.glPopMatrix();
}

From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java

License:Open Source License

@Override
public void dsDrawTriangle(final DVector3C pos, final DMatrix3C R, final float[] vAll, final int v0,
        final int v1, final int v2, boolean solid) {
    if (current_state != 2)
        dsError("drawing function called outside simulation loop");
    setupDrawingMode();/*w w  w  . j  a  v a 2  s.com*/
    GL11.glShadeModel(GL11.GL_FLAT);
    setTransform(pos, R);
    drawTriangle(vAll, v0, v1, v2, solid);
    GL11.glPopMatrix();
}

From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java

License:Open Source License

@Override
public void dsDrawTriangle(final DVector3C pos, final DMatrix3C R, final float[] v0, final float[] v1,
        final float[] v2, boolean solid) {
    if (current_state != 2)
        dsError("drawing function called outside simulation loop");
    setupDrawingMode();/*from   w w w  .j a  v  a  2  s  .co m*/
    GL11.glShadeModel(GL11.GL_FLAT);
    setTransform(pos, R);
    drawTriangle(v0, v1, v2, solid);
    GL11.glPopMatrix();
}

From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java

License:Open Source License

/** 
 * @see DrawStuffApi#dsDrawLine(float[], float[])
 *///ww w.j a  v a 2s . c  o m
@Override
public void dsDrawLine(final float[] pos1, final float[] pos2) {
    setupDrawingMode();
    GL11.glColor3f(color[0], color[1], color[2]);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glLineWidth(2);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex3f(pos1[0], pos1[1], pos1[2]);
    GL11.glVertex3f(pos2[0], pos2[1], pos2[2]);
    GL11.glEnd();
}

From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java

License:Open Source License

/**
 * @see DrawStuffApi#dsDrawConvex(DVector3C, DMatrix3C, double[], int, double[], int, int[])
 */// ww  w .  j a  va  2s. c om
@Override
public void dsDrawConvex(DVector3C pos, DMatrix3C R, double[] _planes, int _planecount, double[] _points,
        int _pointcount, int[] _polygons) {
    if (current_state != 2)
        dsError("drawing function called outside simulation loop");
    setupDrawingMode();
    GL11.glShadeModel(GL11.GL_FLAT);
    setTransform(pos, R);
    drawConvexD(_planes, _planecount, _points, _pointcount, _polygons);
    GL11.glPopMatrix();
    if (use_shadows) {
        setShadowDrawingMode();
        setShadowTransform();
        setTransform(pos, R);
        drawConvexD(_planes, _planecount, _points, _pointcount, _polygons);
        GL11.glPopMatrix();
        GL11.glPopMatrix();
        GL11.glDepthRange(0, 1);
    }
}

From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java

License:Open Source License

@Override
public void dsDrawTriangle(final DVector3C pos, final DMatrix3C R, final DVector3C v0, final DVector3C v1,
        final DVector3C v2, boolean solid) {
    setupDrawingMode();//w w  w.  j a  va 2  s.  co m
    GL11.glShadeModel(GL11.GL_FLAT);
    setTransform(pos, R);
    drawTriangle(v0, v1, v2, solid);
    GL11.glPopMatrix();
}

From source file:org.spoutcraft.api.gui.GenericPolygon.java

License:Open Source License

public void render() {
    GL11.glDisable(GL11.GL_TEXTURE_2D);/*  ww  w .  j  a v  a  2s  . co  m*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glBlendFunc(770, 771);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    MinecraftTessellator t = Spoutcraft.getTessellator();
    GL11.glTranslated(getActualX(), getActualY(), 0);
    t.startDrawingQuads();
    for (Pair<Point, Color> point : points) {
        Point p = point.getLeft();
        Color c = point.getRight();
        t.setColorRGBAFloat(c.getRedF(), c.getGreenF(), c.getBlueF(), c.getAlphaF());
        t.addVertex(p.getX(), p.getY(), 0);

    }
    t.draw();
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:org.spoutcraft.api.gui.RenderUtil.java

License:Open Source License

public static void drawGradientRectangle(int x, int y, int gradientX, int gradientY, int colorOne,
        int colorTwo) {
    float alphaOne = (float) (colorOne >> 24 & 255) / 255.0F;
    float redOne = (float) (colorOne >> 16 & 255) / 255.0F;
    float greenOne = (float) (colorOne >> 8 & 255) / 255.0F;
    float blueOne = (float) (colorOne & 255) / 255.0F;
    float alphaTwo = (float) (colorTwo >> 24 & 255) / 255.0F;
    float redTwo = (float) (colorTwo >> 16 & 255) / 255.0F;
    float greenTwo = (float) (colorTwo >> 8 & 255) / 255.0F;
    float blueTwo = (float) (colorTwo & 255) / 255.0F;
    GL11.glDisable(GL11.GL_TEXTURE_2D);/*from w  w w.  j a v  a 2  s  . c om*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glBlendFunc(770, 771);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    MinecraftTessellator tessellator = Spoutcraft.getTessellator();
    tessellator.startDrawingQuads();
    tessellator.setColorRGBAFloat(redOne, greenOne, blueOne, alphaOne);
    tessellator.addVertex((double) gradientX, (double) y, 0.0D);
    tessellator.addVertex((double) x, (double) y, 0.0D);
    tessellator.setColorRGBAFloat(redTwo, greenTwo, blueTwo, alphaTwo);
    tessellator.addVertex((double) x, (double) gradientY, 0.0D);
    tessellator.addVertex((double) gradientX, (double) gradientY, 0.0D);
    tessellator.draw();
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:org.spoutcraft.client.gui.MCRenderDelegate.java

License:Open Source License

public void render(GenericGradient gradient) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);//ww w  . j  a  va2s .  co  m
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glBlendFunc(770, 771);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    boolean VERT = gradient.getOrientation() == Orientation.VERTICAL;
    tessellator.setColorRGBA_F(gradient.getTopColor().getRedF(), gradient.getTopColor().getGreenF(),
            gradient.getTopColor().getBlueF(), gradient.getTopColor().getAlphaF());
    tessellator.addVertex((VERT ? gradient.getWidth() : 0) + gradient.getScreenX(),
            (VERT ? 0 : gradient.getHeight()) + gradient.getScreenY(), 0.0D);
    tessellator.addVertex(gradient.getScreenX(), gradient.getScreenY(), 0.0D);
    tessellator.setColorRGBA_F(gradient.getBottomColor().getRedF(), gradient.getBottomColor().getGreenF(),
            gradient.getBottomColor().getBlueF(), gradient.getBottomColor().getAlphaF());
    tessellator.addVertex((VERT ? 0 : gradient.getWidth()) + gradient.getScreenX(),
            (VERT ? gradient.getHeight() : 0) + gradient.getScreenY(), 0.0D);
    tessellator.addVertex(gradient.getWidth() + gradient.getScreenX(),
            gradient.getHeight() + gradient.getScreenY(), 0.0D);
    tessellator.draw();
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:RediscoveredMod.RenderRedDragon.java

License:Open Source License

/**
 * Renders the dragon, along with its dying animation
 *//*ww w  .  ja va 2 s  .  co m*/
public void renderDragon(EntityGoodDragon par1EntityGoodDragon, double par2, double par4, double par6,
        float par8, float par9) {
    BossStatus.setBossStatus(par1EntityGoodDragon, false);
    super.doRenderLiving(par1EntityGoodDragon, par2, par4, par6, par8, par9);

    if (par1EntityGoodDragon.healingEnderCrystal != null) {
        float f2 = (float) par1EntityGoodDragon.healingEnderCrystal.innerRotation + par9;
        float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F;
        f3 = (f3 * f3 + f3) * 0.2F;
        float f4 = (float) (par1EntityGoodDragon.healingEnderCrystal.posX - par1EntityGoodDragon.posX
                - (par1EntityGoodDragon.prevPosX - par1EntityGoodDragon.posX) * (double) (1.0F - par9));
        float f5 = (float) ((double) f3 + par1EntityGoodDragon.healingEnderCrystal.posY - 1.0D
                - par1EntityGoodDragon.posY
                - (par1EntityGoodDragon.prevPosY - par1EntityGoodDragon.posY) * (double) (1.0F - par9));
        float f6 = (float) (par1EntityGoodDragon.healingEnderCrystal.posZ - par1EntityGoodDragon.posZ
                - (par1EntityGoodDragon.prevPosZ - par1EntityGoodDragon.posZ) * (double) (1.0F - par9));
        float f7 = MathHelper.sqrt_float(f4 * f4 + f6 * f6);
        float f8 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6);
        GL11.glPushMatrix();
        GL11.glTranslatef((float) par2, (float) par4 + 2.0F, (float) par6);
        GL11.glRotatef((float) (-Math.atan2((double) f6, (double) f4)) * 180.0F / (float) Math.PI - 90.0F, 0.0F,
                1.0F, 0.0F);
        GL11.glRotatef((float) (-Math.atan2((double) f7, (double) f5)) * 180.0F / (float) Math.PI - 90.0F, 1.0F,
                0.0F, 0.0F);
        Tessellator tessellator = Tessellator.instance;
        RenderHelper.disableStandardItemLighting();
        GL11.glDisable(GL11.GL_CULL_FACE);
        this.bindTexture(field_110843_g);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        float f9 = 0.0F - ((float) par1EntityGoodDragon.ticksExisted + par9) * 0.01F;
        float f10 = MathHelper.sqrt_float(f4 * f4 + f5 * f5 + f6 * f6) / 32.0F
                - ((float) par1EntityGoodDragon.ticksExisted + par9) * 0.01F;
        tessellator.startDrawing(5);
        byte b0 = 8;

        for (int i = 0; i <= b0; ++i) {
            float f11 = MathHelper.sin((float) (i % b0) * (float) Math.PI * 2.0F / (float) b0) * 0.75F;
            float f12 = MathHelper.cos((float) (i % b0) * (float) Math.PI * 2.0F / (float) b0) * 0.75F;
            float f13 = (float) (i % b0) * 1.0F / (float) b0;
            tessellator.setColorOpaque_I(0);
            tessellator.addVertexWithUV((double) (f11 * 0.2F), (double) (f12 * 0.2F), 0.0D, (double) f13,
                    (double) f10);
            tessellator.setColorOpaque_I(16777215);
            tessellator.addVertexWithUV((double) f11, (double) f12, (double) f8, (double) f13, (double) f9);
        }

        tessellator.draw();
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glShadeModel(GL11.GL_FLAT);
        RenderHelper.enableStandardItemLighting();
        GL11.glPopMatrix();
    }
}