Example usage for org.lwjgl.opengl GL11 glMatrixMode

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

Introduction

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

Prototype

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

Source Link

Document

Set the current matrix mode.

Usage

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  ww . j  a  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();//from  ww  w.j  a v a 2s  . c  om
            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);
        }
    } 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.fronos.render.items.ItemRendererCandyBow.java

License:Creative Commons License

private void renderItem(EntityLivingBase par1EntityLiving, ItemStack par2ItemStack, int par3) {
    IIcon iicon = par1EntityLiving.getItemIcon(par2ItemStack, par3);

    if (iicon == null) {
        return;//ww w . j  a v a  2 s . co m
    }

    this.mc.getTextureManager()
            .bindTexture(this.mc.getTextureManager().getResourceLocation(par2ItemStack.getItemSpriteNumber()));
    TextureUtil.func_152777_a(false, false, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    float f = iicon.getMinU();
    float f1 = iicon.getMaxU();
    float f2 = iicon.getMinV();
    float f3 = iicon.getMaxV();
    float f4 = 0.0F;
    float f5 = 0.3F;
    GL11.glEnable(32826);
    GL11.glTranslatef(-f4, -f5, 0.0F);
    float f6 = 1.5F;
    GL11.glScalef(f6, f6, f6);
    GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
    ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(),
            0.0625F);

    if (par2ItemStack.hasEffect(par3)) {
        GL11.glDepthFunc(514);
        GL11.glDisable(2896);
        this.mc.getTextureManager().bindTexture(RES_ITEM_GLINT);
        GL11.glEnable(3042);
        GL11.glBlendFunc(768, 1);
        float f7 = 0.76F;
        GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
        GL11.glMatrixMode(5890);
        GL11.glPushMatrix();
        float f8 = 0.125F;
        GL11.glScalef(f8, f8, f8);
        float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F;
        GL11.glTranslatef(f9, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);

        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(f8, f8, f8);
        f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F;
        GL11.glTranslatef(-f9, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);

        GL11.glPopMatrix();
        GL11.glMatrixMode(5888);
        GL11.glDisable(3042);
        GL11.glEnable(2896);
        GL11.glDepthFunc(515);
    }
    GL11.glDisable(32826);
}

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();/*from w ww . java 2s .  c  o m*/
            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;
        }
    }
    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:taiga.gpvm.render.ColorEntityRenderer.java

License:Open Source License

@Override
public void render(Collection<Entity> ents, int pass, ReadableMatrix4 proj, ReadableMatrix4 modelview) {
    if (pass != HardcodedValues.OPAQUE_WORLD_LAYER)
        return;/* w w w.  j av a  2s.  c  o  m*/

    ARBShaderObjects.glUseProgramObjectARB(0);
    GL11.glPointSize(size);

    FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
    proj.store(buffer, false);
    buffer.flip();

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadMatrix(buffer);

    buffer.rewind();
    modelview.store(buffer, false);
    buffer.flip();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadMatrix(buffer);

    GL11.glBegin(GL11.GL_POINTS);

    for (Entity ent : ents) {
        ReadableVector3f loc = ent.getBounds().getCenter();
        GL11.glVertex3f(loc.getX(), loc.getY(), loc.getZ());
        GL11.glColor3f(red, green, blue);
    }

    GL11.glEnd();
}

From source file:taiga.mcmods.buildguide.BlockMarker.java

private void transformToPlayer() {
    FMLClientHandler ch = FMLClientHandler.instance();

    double x = ch.getClient().h.s;
    double y = ch.getClient().h.t;
    double z = ch.getClient().h.u;

    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glPushMatrix();/*from w  w  w .j  ava  2s  . c om*/

    GL11.glTranslated(-x, -y, -z);
}

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

License:BSD License

public void setProjectionMatrix(Matrix4f matrix) {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();// w  ww.j  a  v a2 s . c  om

    FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
    matrix.store(buffer);
    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();/*from   w  w  w. j  av  a2  s  .  c om*/

    FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
    matrix.store(buffer);
    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();// ww w  .  j  av a 2 s  .c  om
    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);

    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();//from ww w.ja va  2s.c o m
    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);

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

    compare(fromGl, manual);
}