Example usage for org.lwjgl.opengl GL11 glShadeModel

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

Introduction

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

Prototype

public static native void glShadeModel(@NativeType("GLenum") int mode);

Source Link

Document

Sets the current shade mode.

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();/*from www. j  av a2s  .  co  m*/
    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();/*from  w  w  w.ja v  a2s  .co m*/
    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  ww.j  a v  a  2 s . c  om
    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#dsDrawCylinder(float[], float[], float, float)
 *//*from w w  w .j ava2  s. co  m*/
@Override
public void dsDrawCylinder(final float[] pos, final float[] R, float length, float radius) {
    if (current_state != 2)
        dsError("drawing function called outside simulation loop");
    setupDrawingMode();
    GL11.glShadeModel(GL11.GL_SMOOTH);
    setTransform(pos, R);
    drawCylinder(length, radius, 0);
    GL11.glPopMatrix();

    if (use_shadows) {
        setShadowDrawingMode();
        setShadowTransform();
        setTransform(pos, R);
        drawCylinder(length, radius, 0);
        GL11.glPopMatrix();
        GL11.glPopMatrix();
        GL11.glDepthRange(0, 1);
    }
}

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

License:Open Source License

/**
 * @see DrawStuffApi#dsDrawCapsule(float[], float[], float, float)
 */// w  ww  .j  av  a2  s. c o m
@Override
public void dsDrawCapsule(final float[] pos, final float[] R, float length, float radius) {
    if (current_state != 2)
        dsError("drawing function called outside simulation loop");
    setupDrawingMode();
    GL11.glShadeModel(GL11.GL_SMOOTH);
    setTransform(pos, R);
    drawCapsule(length, radius);
    GL11.glPopMatrix();

    if (use_shadows) {
        setShadowDrawingMode();
        setShadowTransform();
        setTransform(pos, R);
        drawCapsule(length, radius);
        GL11.glPopMatrix();
        GL11.glPopMatrix();
        GL11.glDepthRange(0, 1);
    }
}

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

License:Open Source License

/** 
 * @see DrawStuffApi#dsDrawLine(float[], float[])
 *///from ww  w  .j a  v  a 2s  .co 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[])
 *///from  w w w  . jav a2s  .  c o  m
@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();/*from   w  ww . j  a v a  2  s.  c  o 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);//from w ww.ja v a2  s . 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  .jav  a  2 s. co  m*/
    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);
}