Example usage for org.lwjgl.opengl GL11 glLoadIdentity

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

Introduction

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

Prototype

public static native void glLoadIdentity();

Source Link

Document

Sets the current matrix to the identity matrix.

Usage

From source file:src.graphics.sfx.SFX.java

License:Open Source License

protected void renderTex(Vec3D[] verts, Texture tex) {
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    tex.bindTex();//from   www.j  av  a2  s  .c  o m
    Vec3D v;
    GL11.glDepthMask(false);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    v = verts[0];
    GL11.glVertex3f(v.x, v.y, v.z);
    GL11.glTexCoord2f(0, 1);
    v = verts[1];
    GL11.glVertex3f(v.x, v.y, v.z);
    GL11.glTexCoord2f(1, 1);
    v = verts[2];
    GL11.glVertex3f(v.x, v.y, v.z);
    GL11.glTexCoord2f(1, 0);
    v = verts[3];
    GL11.glVertex3f(v.x, v.y, v.z);
    GL11.glEnd();
    GL11.glDepthMask(true);
}

From source file:src.graphics.widgets.HUD.java

License:Open Source License

public void renderHUD(Box2D bounds) {
    relBound.set(0, 0, 1, 1);/*from ww  w. j  a va 2s  .com*/
    absBound.set(0, 0, 0, 0);
    updateAsBase(bounds);

    final UINode oldSelect = selected;
    if ((selected == null) || (mouseState != DRAGGED)) {
        selected = selectionAt(mousePos);
    }
    if (mouseState != HOVERED) {
        //hoverStart = System.currentTimeMillis() ;
    } else if (selected != null && selected != oldSelect) {
        hoverStart = System.currentTimeMillis();
    }
    if (selected != null)
        switch (mouseState) {
        case (HOVERED):
            selected.whenHovered();
            break;
        case (CLICKED):
            selected.whenClicked();
            break;
        case (PRESSED):
            selected.whenPressed();
            break;
        case (DRAGGED):
            selected.whenDragged();
            break;
        }

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, bounds.xdim(), 0, bounds.ydim(), -100, 100);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    super.render();
}

From source file:stevekung.mods.moreplanets.planets.diona.render.entities.RenderDionaCreeperBoss.java

License:Creative Commons License

protected int func_27006_a(EntityDionaCreeperBoss par1EntityCreeper, int par2, float par3) {
    if (par1EntityCreeper.isArmored()) {
        if (par2 == 1) {
            final float f1 = par1EntityCreeper.ticksExisted + par3;
            this.bindTexture(RenderDionaCreeperBoss.invulnerableCreeperTexture);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            final float f2 = f1 * 0.01F;
            final float f3 = f1 * 0.01F;
            GL11.glTranslatef(f2, f3, 0.0F);
            this.setRenderPassModel(this.mainModel);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }/*ww w  .java  2  s .c o  m*/
        if (par2 == 2) {
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
        }
    } else if (!par1EntityCreeper.isArmored()) {
        if (par2 == 1) {
            final float f1 = par1EntityCreeper.ticksExisted + par3;
            this.bindTexture(RenderDionaCreeperBoss.powerTexture);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            final float f2 = f1 * 0.01F;
            final float f3 = f1 * 0.01F;
            GL11.glTranslatef(f2, f3, 0.0F);
            this.setRenderPassModel(this.mainModel);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }
        if (par2 == 2) {
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
        }
    }
    return -1;
}

From source file:stevekung.mods.moreplanets.planets.diona.render.entities.RenderDionaMinionCreeper.java

License:Creative Commons License

protected int renderCreeperPassModel(EntityDionaMinionCreeper par1EntityCreeper, int par2, float par3) {
    if (par1EntityCreeper.getPowered()) {
        if (par1EntityCreeper.isInvisible()) {
            GL11.glDepthMask(false);/* w w  w .  ja v  a2  s.c om*/
        } else {
            GL11.glDepthMask(true);
        }

        if (par2 == 1) {
            float f1 = par1EntityCreeper.ticksExisted + par3;
            this.bindTexture(RenderDionaMinionCreeper.powerTexture);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            float f2 = f1 * 0.01F;
            float f3 = f1 * 0.01F;
            GL11.glTranslatef(f2, f3, 0.0F);
            this.setRenderPassModel(this.creeperModel);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            float f4 = 0.5F;
            GL11.glColor4f(f4, f4, f4, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }

        if (par2 == 2) {
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
        }
    }

    return -1;
}

From source file:stevekung.mods.moreplanets.planets.fronos.render.entities.RenderFronosCreeperBossTemp.java

License:Creative Commons License

protected int func_27006_a(EntityFronosCreeperBossTemp par1EntityCreeper, int par2, float par3) {
    if (par1EntityCreeper.isArmored()) {
        if (par2 == 1) {
            final float f1 = par1EntityCreeper.ticksExisted + par3;
            this.bindTexture(RenderFronosCreeperBossTemp.invulnerableCreeperTexture);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            final float f2 = f1 * 0.01F;
            final float f3 = f1 * 0.01F;
            GL11.glTranslatef(f2, f3, 0.0F);
            this.setRenderPassModel(this.mainModel);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }//from  w w w. j  ava  2  s.  co m
        if (par2 == 2) {
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
        }
    } else if (!par1EntityCreeper.isArmored()) {
        if (par2 == 1) {
            final float f1 = par1EntityCreeper.ticksExisted + par3;
            this.bindTexture(RenderFronosCreeperBossTemp.powerTexture);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            final float f2 = f1 * 0.01F;
            final float f3 = f1 * 0.01F;
            GL11.glTranslatef(f2, f3, 0.0F);
            this.setRenderPassModel(this.mainModel);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }
        if (par2 == 2) {
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
        }
    }
    return -1;
}

From source file:stevekung.mods.moreplanets.planets.siriusb.render.entities.RenderEvolvedSiriusBlazeBoss.java

License:Creative Commons License

protected int func_27006_a(EntityEvolvedSiriusBlazeBoss blaze, int par2, float par3) {
    if (par2 == 1) {
        if (blaze.getHealth() <= 32.0F) {
            float var4 = blaze.ticksExisted + par3;
            this.bindTexture(this.powerTexture);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            float var5 = var4 * 0.01F;
            float var6 = var4 * 0.01F;
            GL11.glTranslatef(var5, var6, 0.0F);
            this.setRenderPassModel(this.mainModel);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            float var7 = 0.5F;
            GL11.glColor4f(var7, var7, var7, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }/*from  w ww.ja va2s  .c o  m*/
    }
    if (par2 == 2) {
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glLoadIdentity();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_BLEND);
    }
    return -1;
}

From source file:tectonicus.rasteriser.lwjgl.LwjglRasteriser.java

License:BSD License

public void setProjectionMatrix(Matrix4f matrix) {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
    matrix.store(buffer);// w  w  w . j  av  a  2  s.co  m
    buffer.flip();
    GL11.glLoadMatrix(buffer);
}

From source file:tectonicus.rasteriser.lwjgl.LwjglRasteriser.java

License:BSD License

public void setCameraMatrix(Matrix4f matrix, Vector3f lookAt, Vector3f eye, Vector3f up) {
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
    matrix.store(buffer);/* w  ww  . j  a  v  a2s.c o  m*/
    buffer.flip();
    GL11.glLoadMatrix(buffer);
}

From source file:tectonicus.util.MatrixUtil.java

License:BSD License

public static void testLookAtMatrix(Vector3f eye, Vector3f center, Vector3f up) {
    // Make a lookat matrix in opengl and pull it out into a Matrix4f
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GLU.gluLookAt(eye.x, eye.y, eye.z, center.x, center.y, center.z, up.x, up.y, up.z);

    FloatBuffer fromGlBuffer = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW, fromGlBuffer);
    Matrix4f fromGl = new Matrix4f();
    fromGl.load(fromGlBuffer);/*from   www  . j av  a2s .c o m*/

    Matrix4f manual = createLookAt(eye, center, up);

    compare(fromGl, manual);
}

From source file:tectonicus.util.MatrixUtil.java

License:BSD License

public static void testOrthoMatrix(final int left, final int right, final int bottom, final int top,
        final int near, final int far) {
    // Make an ortho matrix in opengl and pull it out into a Matrix4f
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glOrtho(left, right, bottom, top, near, far);
    FloatBuffer fromGlBuffer = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW, fromGlBuffer);
    Matrix4f fromGl = new Matrix4f();
    fromGl.load(fromGlBuffer);/*from ww w  .  j a v  a2 s  .  c om*/

    Matrix4f manual = createOrthoMatrix(left, right, bottom, top, near, far);

    compare(fromGl, manual);
}