Example usage for org.lwjgl.opengl GL11 GL_CURRENT_BIT

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

Introduction

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

Prototype

int GL_CURRENT_BIT

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

Click Source Link

Document

AttribMask

Usage

From source file:fr.def.iss.vd2.lib_v3d.element.V3DCircle.java

License:Open Source License

private void drawCircle() {
    GL11.glBegin(GL11.GL_TRIANGLE_FAN);//  w w  w. j  av a  2 s  .co  m

    if (customColor) {
        GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor3f(innerColor.r, innerColor.g, innerColor.b);
    }
    GL11.glVertex3f(0.0f, 0.0f, 0.0f); // center

    float step = 2f * (float) Math.PI / (float) quality;
    if (customColor) {

        GL11.glColor4f(outerColor.r, outerColor.g, outerColor.b, outerColor.a);
    }

    for (int i = 0; i <= quality; i++) {
        GL11.glVertex3f((float) (radius * Math.cos(step * i)), (float) (radius * Math.sin(step * i)), 0f);
    }

    if (customColor) {

        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glPopAttrib();
    }

    GL11.glEnd();

}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DCircle.java

License:Open Source License

private void drawExternCircle() {

    float step = 2f * (float) Math.PI / (float) quality;

    if (customColor) {
        GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    }/*from  w  w w .  j av  a 2 s.  co m*/

    GL11.glBegin(GL11.GL_TRIANGLE_STRIP);

    for (int i = 0; i <= quality; i++) {
        if (customColor) {
            GL11.glColor4f(innerColor.r, innerColor.g, innerColor.b, innerColor.a);
        }
        GL11.glVertex3f((float) (innerRadius * Math.cos(step * i)), (float) (innerRadius * Math.sin(step * i)),
                0f);

        if (customColor) {
            GL11.glColor4f(outerColor.r, outerColor.g, outerColor.b, outerColor.a);
        }
        GL11.glVertex3f((float) (radius * Math.cos(step * i)), (float) (radius * Math.sin(step * i)), 0f);
    }

    GL11.glEnd();

    if (customColor) {
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glPopAttrib();
    }

}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DColorElement.java

License:Open Source License

@Override
protected void doDisplay(I3dCamera camera) {
    if (childElement == null) {
        return;//w ww .ja  v a  2s.c  o m
    }
    GL11.glPushAttrib(GL11.GL_CURRENT_BIT);

    GL11.glColor4f(color.r, color.g, color.b, color.a);
    float[] matDiffuse = { color.r, color.g, color.b, color.a };

    //TODO repair
    //GL12.glMaterialfv(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE, matDiffuse, 0);

    childElement.display(camera);

    GL11.glPopAttrib();

}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DShaderElement.java

License:Open Source License

@Override
protected void doDisplay(I3dCamera camera) {
    if (childElement == null) {
        return;/*from   w  ww . j av  a2  s  .c o  m*/
    }

    GL11.glPushAttrib(GL11.GL_CURRENT_BIT);

    shader.begin();

    childElement.display(camera);

    shader.end();

    GL11.glPopAttrib();

}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DSprite.java

License:Open Source License

@Override
protected void doDisplay(V3DCamera camera) {

    if (!enableColor) {
        GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
        GL11.glColor4f(1, 1, 1, opacity);
    }//from w w  w  .  j a  va  2s . c  o m

    GL11.glEnable(GL11.GL_TEXTURE_2D);

    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);

    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f);
    GL11.glEnable(GL11.GL_ALPHA_TEST);

    if (disableRotation) {
        camera.disableRotation();
    }

    float w = 0.5f * size.x * image.getWidth();
    float h = 0.5f * size.y * image.getHeight();

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getID());
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex3f(-w, -h, 0.0f);
    GL11.glTexCoord2f(1.0f, 0.0f);
    GL11.glVertex3f(w, -h, 0.0f);
    GL11.glTexCoord2f(1.0f, 1.0f);
    GL11.glVertex3f(w, h, 0.0f);
    GL11.glTexCoord2f(0.0f, 1.0f);
    GL11.glVertex3f(-w, h, 0.0f);
    GL11.glEnd();

    if (disableRotation) {
        camera.enableRotation();
    }

    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    if (!enableColor) {
        GL11.glPopAttrib();
    }
}

From source file:matteroverdrive.client.model.MOModelRenderColored.java

License:Open Source License

@SideOnly(Side.CLIENT)
public void render(float p_78785_1_) {
    if (disableLighting) {
        GL11.glDisable(GL11.GL_LIGHTING);
        RenderUtils.disableLightmap();//from ww  w.  j a  v a  2s.c  om
    }

    GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
    RenderUtils.applyColor(color);
    super.render(p_78785_1_);
    GL11.glPopAttrib();
    if (disableLighting) {
        GL11.glEnable(GL11.GL_LIGHTING);
        RenderUtils.enableLightmap();
    }
}