Example usage for org.lwjgl.opengl GL11 glScaled

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

Introduction

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

Prototype

public static native void glScaled(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glScalef Scalef .

Usage

From source file:nightkosh.gravestone_extended.renderer.tileentity.GraveInGuiRenderer.java

License:LGPL

protected static void scaleAndRotate(float x, float y, float scale, float partialTicks) {
    GL11.glTranslatef(x, y, 80);//from www.java  2  s. co  m

    GL11.glRotatef((Minecraft.getMinecraft().world.getTotalWorldTime() + partialTicks) % 360, 0, 1, 0);

    GL11.glScaled(scale, scale, scale);
}

From source file:nightkosh.gravestone_extended.renderer.tileentity.TileEntityMemorialRenderer.java

License:LGPL

public void renderMemorialInGui(float x, float y, EnumMemorials memorial, boolean isEnchanted, boolean isMossy,
        float partialTicks) {
    GL11.glPushMatrix();//  www  . j a va2  s .  c  om

    GL11.glTranslatef(x, y, 80);

    float time = Minecraft.getMinecraft().theWorld.getTotalWorldTime() + partialTicks;
    GL11.glRotatef(time % 360, 0, 1, 0);

    float scale = 75 / 4;
    GL11.glScaled(scale, scale, scale);

    renderMemorial(memorial, memorial.getMemorialType(), isEnchanted, isMossy);

    GL11.glPopMatrix();
}

From source file:org.blockartistry.mod.DynSurround.client.fx.particle.EntityTextPopOffFX.java

License:MIT License

@Override
public void renderParticle(final WorldRenderer renderer, final Entity entity, final float x, final float y,
        final float z, final float dX, final float dY, final float dZ) {
    this.rotationYaw = (-Minecraft.getMinecraft().thePlayer.rotationYaw);
    this.rotationPitch = Minecraft.getMinecraft().thePlayer.rotationPitch;

    final float locX = ((float) (this.prevPosX + (this.posX - this.prevPosX) * x - interpPosX));
    final float locY = ((float) (this.prevPosY + (this.posY - this.prevPosY) * y - interpPosY));
    final float locZ = ((float) (this.prevPosZ + (this.posZ - this.prevPosZ) * z - interpPosZ));

    GL11.glPushMatrix();/*  w ww. j  av  a  2  s .  c om*/
    if (this.shouldOnTop) {
        GL11.glDepthFunc(519);
    } else {
        GL11.glDepthFunc(515);
    }
    GL11.glTranslatef(locX, locY, locZ);
    GL11.glRotatef(this.rotationYaw, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(this.rotationPitch, 1.0F, 0.0F, 0.0F);

    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    GL11.glScaled(this.particleScale * 0.008D, this.particleScale * 0.008D, this.particleScale * 0.008D);
    GL11.glScaled(this.scale, this.scale, this.scale);

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 0.003662109F);
    GL11.glEnable(3553);
    GL11.glDisable(3042);
    GL11.glDepthMask(true);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(3553);
    GL11.glEnable(2929);
    GL11.glDisable(2896);
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(3042);
    GL11.glEnable(3008);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
    fontRenderer.drawStringWithShadow(this.text,
            -MathHelper.floor_float(fontRenderer.getStringWidth(this.text) / 2.0F) + 1,
            -MathHelper.floor_float(fontRenderer.FONT_HEIGHT / 2.0F) + 1, this.renderColor.rgb());

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDepthFunc(515);

    GL11.glPopMatrix();
    if (this.grow) {
        this.particleScale *= 1.08F;
        if (this.particleScale > SIZE * 3.0D) {
            this.grow = false;
        }
    } else {
        this.particleScale *= 0.96F;
    }
}

From source file:org.blockartistry.mod.DynSurround.client.fx.particle.ParticleTextPopOff.java

License:MIT License

@Override
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX,
        float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
    this.rotationYaw = (-Minecraft.getMinecraft().thePlayer.rotationYaw);
    this.rotationPitch = Minecraft.getMinecraft().thePlayer.rotationPitch;

    final float locX = ((float) (this.prevPosX + (this.posX - this.prevPosX) * partialTicks - interpPosX));
    final float locY = ((float) (this.prevPosY + (this.posY - this.prevPosY) * partialTicks - interpPosY));
    final float locZ = ((float) (this.prevPosZ + (this.posZ - this.prevPosZ) * partialTicks - interpPosZ));

    GL11.glPushMatrix();//www . j  a  v  a  2s.co m
    if (this.showOnTop) {
        GL11.glDepthFunc(519);
    } else {
        GL11.glDepthFunc(515);
    }
    GL11.glTranslatef(locX, locY, locZ);
    GL11.glRotatef(this.rotationYaw, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(this.rotationPitch, 1.0F, 0.0F, 0.0F);

    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    GL11.glScaled(this.particleScale * 0.008D, this.particleScale * 0.008D, this.particleScale * 0.008D);
    GL11.glScaled(this.scale, this.scale, this.scale);

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 0.003662109F);
    GL11.glEnable(3553);
    GL11.glDisable(3042);
    GL11.glDepthMask(true);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(3553);
    GL11.glEnable(2929);
    GL11.glDisable(2896);
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(3042);
    GL11.glEnable(3008);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
    fontRenderer.drawStringWithShadow(this.text,
            -MathHelper.floor_float(fontRenderer.getStringWidth(this.text) / 2.0F) + 1,
            -MathHelper.floor_float(fontRenderer.FONT_HEIGHT / 2.0F) + 1, this.renderColor.rgb());

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDepthFunc(515);

    GL11.glPopMatrix();
    if (this.grow) {
        this.particleScale *= 1.08F;
        if (this.particleScale > SIZE * 3.0D) {
            this.grow = false;
        }
    } else {
        this.particleScale *= 0.96F;
    }
}

From source file:org.cogaen.lwjgl.scene.Camera.java

License:Open Source License

void applyTransform() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();/*www .  j  a va 2  s  .c  o  m*/
    GL11.glOrtho(0, this.width, 0, this.height, 1, -1);
    GL11.glTranslated(this.width / 2, this.height / 2, 0.0);

    GL11.glScaled(this.zoom, this.zoom, 0.0);
    GL11.glRotatef((float) -this.angle, 0, 0, 1);
    GL11.glTranslated(-this.posX, -this.posY, 0);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glViewport(this.viewport.getX(), this.viewport.getY(), this.viewport.getWidth(),
            this.viewport.getHeight());
}

From source file:org.cogaen.lwjgl.scene.CommandLineVisual.java

License:Open Source License

@Override
public void render() {
    GL11.glScaled(getScale(), -getScale(), 1);
    getColor().apply();//ww w  .  j a  v a2  s.co  m

    if (this.timeStamp < this.timer.getTime()) {
        this.timeStamp = this.timer.getTime() + BLINK_TIME;
        this.cursorOn = !this.cursorOn;
    }

    for (int i = 0; i < this.lines.length; ++i) {
        if (i == this.curLine && this.cursorOn) {
            this.ttf.drawString((float) (-this.width / 2),
                    (float) (-this.height / 2 + i * ttf.getHeight() * LINE_SPACE),
                    this.lines[i].toString() + "_");
        } else {
            this.ttf.drawString((float) (-this.width / 2),
                    (float) (-this.height / 2 + i * ttf.getHeight() * LINE_SPACE), this.lines[i].toString());
        }
    }
}

From source file:org.cogaen.lwjgl.scene.MultiLineLabelVisual.java

License:Open Source License

@Override
public void render() {
    GL11.glPushMatrix();/*from  ww w .j a  va  2 s .  c om*/
    GL11.glScaled(getScale(), -getScale(), 1);
    org.newdawn.slick.Color utilColor = new org.newdawn.slick.Color((int) (getColor().getRed() * 255),
            (int) (getColor().getGreen() * 255), (int) (getColor().getBlue() * 255),
            (int) (getColor().getAlpha() * 255));

    for (int i = 0; i < this.lines.length; ++i) {
        switch (this.alignment) {

        case LEFT:
            this.ttf.drawString((float) (-this.width / 2),
                    (float) (-this.height / 2 + i * ttf.getHeight() * LINE_SPACE), this.lines[i].toString(),
                    utilColor);
            break;

        case CENTER: {
            float textWidth = this.ttf.getWidth(this.lines[i].toString());
            this.ttf.drawString(-textWidth / 2, (float) (-this.height / 2 + i * ttf.getHeight() * LINE_SPACE),
                    this.lines[i].toString(), utilColor);
            break;
        }

        case RIGHT: {
            float textWidth = this.ttf.getWidth(this.lines[i].toString());
            this.ttf.drawString((float) (this.width / 2) - textWidth,
                    (float) (-this.height / 2 + i * ttf.getHeight() * LINE_SPACE), this.lines[i].toString(),
                    utilColor);
        }

        }
    }
    GL11.glPopMatrix();
}

From source file:org.cogaen.lwjgl.scene.SpriteFxVisual.java

License:Open Source License

@Override
public void render() {
    if (this.flipVertical) {
        GL11.glScaled(1, -1, 1);
    }// ww w  . j  ava  2s .  c o m

    if (this.shadow) {
        double dx = this.halfWidth * getScale() * 0.02;
        double dy = this.halfWidth * getScale() * 0.02;
        GL11.glColor4d(getColor().getRed() * 0.1, getColor().getGreen() * 0.1, getColor().getBlue() * 0.1, 0.7);

        GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(0.0f, this.texture.getHeight());
        GL11.glVertex2d(-this.halfWidth * getScale() + dx, -this.halfHeight * getScale() - dy);

        GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight());
        GL11.glVertex2d(this.halfWidth * getScale() + dx, -this.halfHeight * getScale() - dy);

        GL11.glTexCoord2f(this.texture.getWidth(), 0);
        GL11.glVertex2d(this.halfWidth * getScale() + dx, this.halfHeight * getScale() - dy);

        GL11.glTexCoord2f(0.0f, 0.0f);
        GL11.glVertex2d(-this.halfWidth * getScale() + dx, this.halfHeight * getScale() - dy);
    }

    getColor().apply();

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0.0f, this.texture.getHeight());
    GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * getScale());

    GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight());
    GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * getScale());

    GL11.glTexCoord2f(this.texture.getWidth(), 0);
    GL11.glVertex2d(this.halfWidth * getScale(), this.halfHeight * getScale());

    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex2d(-this.halfWidth * getScale(), this.halfHeight * getScale());

    if (this.mirror) {
        GL11.glColor4d(getColor().getRed() * 0.7, getColor().getGreen() * 0.7, getColor().getBlue() * 0.7, 0.7);

        GL11.glTexCoord2f(0.0f, this.texture.getHeight());
        GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * getScale());

        GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight());
        GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * getScale());

        GL11.glColor4d(getColor().getRed(), getColor().getGreen(), getColor().getBlue(), 0);
        GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight() / 2);
        GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * 2 * getScale());

        GL11.glTexCoord2f(0.0f, this.texture.getHeight() / 2);
        GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * 2 * getScale());
    }

    GL11.glEnd();
}

From source file:org.cogaen.lwjgl.scene.SpriteVisual.java

License:Open Source License

@Override
public void render() {
    getColor().apply();//from   w ww  .  ja  v a  2 s. com

    if (this.flipVertical) {
        GL11.glScaled(1, -1, 1);
    }

    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0.0f, this.texture.getHeight());
    GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * getScale());

    GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight());
    GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * getScale());

    GL11.glTexCoord2f(this.texture.getWidth(), 0);
    GL11.glVertex2d(this.halfWidth * getScale(), this.halfHeight * getScale());

    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex2d(-this.halfWidth * getScale(), this.halfHeight * getScale());
    GL11.glEnd();
}

From source file:org.cogaen.lwjgl.scene.TextBlockVisual.java

License:Open Source License

@Override
public void render() {
    GL11.glPushMatrix();//  w ww . j  a v a 2  s  . c o m
    GL11.glScaled(getScale(), -getScale(), 1);
    getColor().apply();

    org.newdawn.slick.Color utilColor = new org.newdawn.slick.Color((int) (getColor().getRed() * 255),
            (int) (getColor().getGreen() * 255), (int) (getColor().getBlue() * 255),
            (int) (getColor().getAlpha() * 255));

    if (this.timeStamp < this.timer.getTime()) {
        this.timeStamp = this.timer.getTime() + BLINK_TIME;
        this.cursorOn = !this.cursorOn;
    }

    for (int i = 0; i < this.lines.length; ++i) {
        this.ttf.drawString((float) (-this.width / 2),
                (float) (-this.height / 2 + i * ttf.getHeight() * LINE_SPACE), this.lines[i].toString(),
                utilColor);
    }

    if (this.cursorOn && this.showCursor) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);

        double offsetX;
        if (this.curX == 0) {
            offsetX = 0;
        } else if (this.curX >= this.lines[this.curY].length()) {
            offsetX = this.ttf.getWidth(this.lines[this.curY].substring(0, this.lines[this.curY].length()));
        } else {
            offsetX = this.ttf.getWidth(this.lines[this.curY].substring(0, this.curX));
        }
        double offsetY = this.curY * this.ttf.getHeight() * LINE_SPACE;

        double x = -this.width / 2 + offsetX;
        double y = -this.height / 2 + offsetY + this.ttf.getHeight() / 2;
        double curHeight = this.ttf.getHeight() / 2 * 0.8;

        GL11.glBegin(GL11.GL_LINES);
        GL11.glVertex2d(x, y + curHeight);
        GL11.glVertex2d(x, y - curHeight);
        GL11.glEnd();
    }
    GL11.glPopMatrix();
}