Example usage for org.lwjgl.opengl GL11 glPopMatrix

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

Introduction

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

Prototype

public static native void glPopMatrix();

Source Link

Document

Pops the top entry off the current matrix stack, replacing the current matrix with the matrix that was the second entry in the stack.

Usage

From source file:cn.weaponry.api.client.render.RendererWeapon.java

License:Open Source License

private void handleEntityItemRender(ItemStack stack) {
    GL11.glPushMatrix();//w w w .  ja v  a 2  s.  c  o m
    {
        GL11.glRotated(30, 0, 0, 1);
        stdTransform.doTransform();
        RenderUtils.loadTexture(texture);
        model.renderAll();
    }
    GL11.glPopMatrix();
}

From source file:cn.weaponry.impl.classic.client.animation.Muzzleflash.java

License:Open Source License

@Override
public void render(ItemInfo info, PartedModel model, boolean firstPerson) {
    double alpha = 1.0;

    if (texture == null && textures != null) {
        texture = textures[RandUtils.nextInt(textures.length)];
    }// w  w  w.  j  a  va2 s  .  c o  m

    //Blend in
    long dt = getTime();
    if (dt < 40) {
        alpha = dt / 40.0;
    } else if (dt > lifeTime - 40.0) {
        alpha = (lifeTime - dt) / 40.0;
    }

    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glPushMatrix();
    RenderUtils.loadTexture(texture == null ? MISSING : texture);
    GL11.glTranslated(x, y, z);

    material.setTexture(texture);
    GL11.glScaled(size, size, size);
    material.color.a = alpha * 0.8;
    GL11.glRotatef(90, 0, 1, 0);
    mesh.draw(material);
    GL11.glColor4d(1, 1, 1, 1);

    GL11.glPopMatrix();
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:colonialdisplay.AntDisplayGL.java

@Override
protected void renderGL() {

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

    GL11.glPushMatrix();
    {
        drawBackground();
        drawForeGround();
    }
    GL11.glPopMatrix();
}

From source file:com.ardor3d.renderer.lwjgl.LwjglFont.java

License:Open Source License

/**
 * <code>print</code> renders the specified string to a given (x,y) location. The x, y location is in terms of
 * screen coordinates. There are currently two sets of fonts supported: NORMAL and ITALICS.
 * /*from   w ww .ja  v a  2  s.c  o m*/
 * @param r
 * 
 * @param x
 *            the x screen location to start the string render.
 * @param y
 *            the y screen location to start the string render.
 * @param text
 *            the String to render.
 * @param set
 *            the mode of font: NORMAL or ITALICS.
 */
public void print(final Renderer r, final double x, final double y, final ReadOnlyVector3 scale,
        final StringBuffer text, int set) {
    final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord();
    if (set > 1) {
        set = 1;
    } else if (set < 0) {
        set = 0;
    }

    final boolean alreadyOrtho = r.isInOrthoMode();
    if (!alreadyOrtho) {
        r.setOrtho();
    } else {
        LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW);
        GL11.glPushMatrix();
        GL11.glLoadIdentity();
    }
    GL11.glTranslated(x, y, 0);
    GL11.glScaled(scale.getX(), scale.getY(), scale.getZ());
    GL11.glListBase(base - 32 + (128 * set));

    // Put the string into a "pointer"
    if (text.length() > scratch.capacity()) {
        scratch = BufferUtils.createByteBuffer(text.length());
    } else {
        scratch.clear();
    }

    final int charLen = text.length();
    for (int z = 0; z < charLen; z++) {
        scratch.put((byte) text.charAt(z));
    }
    scratch.flip();
    GL11.glColor4f(fontColor.getRed(), fontColor.getGreen(), fontColor.getBlue(), fontColor.getAlpha());
    // call the list for each letter in the string.
    GL11.glCallLists(scratch);
    // set color back to white
    GL11.glColor4f(1, 1, 1, 1);

    if (!alreadyOrtho) {
        r.unsetOrtho();
    } else {
        LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW);
        GL11.glPopMatrix();
    }
}

From source file:com.ardor3d.renderer.lwjgl.LwjglRenderer.java

License:Open Source License

public void unsetOrtho() {
    if (!_inOrthoMode) {
        throw new Ardor3dException("Not in Orthographic mode.");
    }//ww  w. j  a  v  a 2  s . co m
    // remove ortho mode, and go back to original
    // state
    final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord();
    LwjglRendererUtil.switchMode(matRecord, GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    _inOrthoMode = false;
}

From source file:com.ardor3d.renderer.lwjgl.LwjglRenderer.java

License:Open Source License

public void undoTransforms(final ReadOnlyTransform transform) {
    final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord();
    LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
}

From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java

License:Apache License

public final void glPopMatrix() {
    GL11.glPopMatrix();
}

From source file:com.blogspot.jabelarminecraft.magicbeans.models.ModelGiant.java

License:Open Source License

/**
 * Renders specific entity to allow access to any specific fields
 * @param parEntity//from  w  ww  .java2s  .  co m
 * @param par2
 * @param par3
 * @param par4
 * @param par5
 * @param par6
 * @param par7
 */
public void renderGiant(EntityGiant parEntity, float par2, float par3, float par4, float par5, float par6,
        float par7) {
    setRotationAngles(parEntity, par2, par3, par4, par5, par6, par7, parEntity);

    // scale the whole thing for big or small entities
    GL11.glPushMatrix();
    GL11.glTranslatef(0F, 1.5F - 1.5F * parEntity.getScaleFactor(), 0F);
    GL11.glScalef(parEntity.getScaleFactor(), parEntity.getScaleFactor(), parEntity.getScaleFactor());

    bipedHead.render(par7);
    bipedBody.render(par7);
    bipedRightArm.render(par7);
    bipedLeftArm.render(par7);
    bipedRightLeg.render(par7);
    bipedLeftLeg.render(par7);
    bipedHeadwear.render(par7);

    // don't forget to pop the matrix for overall scaling
    GL11.glPopMatrix();
}

From source file:com.blogspot.jabelarminecraft.magicbeans.models.ModelGoldenGoose.java

License:Open Source License

/**
 * Renders specific entity to allow access to any specific fields
 * @param parEntity//from w w  w . j  a  v a2s  .c o  m
 * @param par2
 * @param par3
 * @param par4
 * @param par5
 * @param par6
 * @param par7
 */
public void renderGoldenGoose(EntityGoldenGoose parEntity, float par2, float par3, float par4, float par5,
        float par6, float par7) {
    setRotationAngles(par2, par3, par4, par5, par6, par7, parEntity);

    // scale the whole thing for big or small entities
    GL11.glPushMatrix();
    GL11.glTranslatef(0F, 1.5F - 1.5F * parEntity.getScaleFactor(), 0F);
    GL11.glScalef(parEntity.getScaleFactor(), parEntity.getScaleFactor(), parEntity.getScaleFactor());

    if (isChild) {
        float f6 = 2.0F;
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 5.0F * par7, 2.0F * par7);
        head.render(par7);
        bill.render(par7);
        chin.render(par7);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
        GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);
        body.render(par7);
        rightLeg.render(par7);
        leftLeg.render(par7);
        rightWing.render(par7);
        leftWing.render(par7);
        GL11.glPopMatrix();
    } else {
        head.render(par7);
        bill.render(par7);
        chin.render(par7);
        body.render(par7);
        rightLeg.render(par7);
        leftLeg.render(par7);
        rightWing.render(par7);
        leftWing.render(par7);
    }

    // don't forget to pop the matrix for overall scaling
    GL11.glPopMatrix();
}

From source file:com.blogspot.jabelarminecraft.magicbeans.renderers.RenderGoldenEggThrown.java

License:Open Source License

/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 *//*w w w .  j a v  a 2  s . co  m*/
@Override
public void doRender(Entity parEntity, double parX, double parY, double parZ, float parIgnored1,
        float parIgnored2) {
    //        IIcon iicon = itemBasisForEntity.getIconFromDamage(iconIndex);
    //        
    //        if (iicon != null)
    //        {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) parX, (float) parY, (float) parZ);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glScalef(0.5F, 0.5F, 0.5F);
    int l = 0xF5E16F;
    float f5 = (l >> 16 & 255) / 255.0F;
    float f6 = (l >> 8 & 255) / 255.0F;
    float f7 = (l & 255) / 255.0F;
    GL11.glColor4f(f5, f6, f7, 1.0F);
    bindEntityTexture(parEntity);
    Tessellator tessellator = Tessellator.getInstance();

    //            if (iicon == ItemPotion.func_94589_d("bottle_splash"))
    //            {
    //                int i = PotionHelper.func_77915_a(((EntityPotion)parEntity).getPotionDamage(), false);
    //                float f2 = (i >> 16 & 255) / 255.0F;
    //                float f3 = (i >> 8 & 255) / 255.0F;
    //                float f4 = (i & 255) / 255.0F;
    //                GL11.glColor3f(f2, f3, f4);
    //                GL11.glPushMatrix();
    //                invokeTesselator(tessellator, ItemPotion.func_94589_d("overlay"));
    //                GL11.glPopMatrix();
    //                GL11.glColor3f(1.0F, 1.0F, 1.0F);
    //            }

    //            invokeTesselator(tessellator, iicon);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    //        }
}