Example usage for org.lwjgl.opengl GL11 glRotatef

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

Introduction

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

Prototype

public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x,
        @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);

Source Link

Document

Manipulates the current matrix with a rotation matrix.

Usage

From source file:growthcraft.milk.client.render.RenderPancheon.java

License:Open Source License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
    if (modelID == RENDER_ID) {
        GL11.glPushMatrix();//w w  w  .  j  a v a 2 s.c  o  m
        {
            Minecraft.getMinecraft().renderEngine.bindTexture(GrcMilkResources.INSTANCE.texturePancheon);
            GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0.0f, -1.0f, 0.0f);
            GrcMilkResources.INSTANCE.modelPancheon.render(null, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
                    ModelPancheon.SCALE);
        }
        GL11.glPopMatrix();
    }
}

From source file:growthcraft.milk.client.renderer.TileEntityButterChurnRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
    if (te instanceof TileEntityButterChurn) {
        final TileEntityButterChurn butterChurn = (TileEntityButterChurn) te;
        GL11.glPushMatrix();/*from   w  ww  .ja va 2s. co m*/
        {
            GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5f, (float) z + 0.5F);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
            this.bindTexture(GrcMilkResources.INSTANCE.textureButterChurn);
            GrcMilkResources.INSTANCE.modelButterChurn.render((Entity) null, butterChurn.animProgress,
                    butterChurn.animDir, 0.0f, f, 0.0f, ModelButterChurn.SCALE);
        }
        GL11.glPopMatrix();
    }
}

From source file:growthcraft.milk.client.renderer.TileEntityCheesePressRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
    if (te instanceof TileEntityCheesePress) {
        final TileEntityCheesePress cheesePress = (TileEntityCheesePress) te;
        GL11.glPushMatrix();/* w ww.j a v a 2 s  .  c om*/
        {
            GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5f, (float) z + 0.5F);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
            this.bindTexture(GrcMilkResources.INSTANCE.textureCheesePress);
            GrcMilkResources.INSTANCE.modelCheesePress.render((Entity) null, cheesePress.animProgress,
                    cheesePress.animDir, 0.0f, f, 0.0f, ModelCheesePress.SCALE);
        }
        GL11.glPopMatrix();
    }
}

From source file:growthcraft.milk.client.renderer.TileEntityCheeseVatRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
    if (te instanceof TileEntityCheeseVat) {
        final TileEntityCheeseVat cheeseVat = (TileEntityCheeseVat) te;
        GL11.glPushMatrix();/*from   w  w w  .j a  va2  s.c om*/
        {
            GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5f, (float) z + 0.5F);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
            this.bindTexture(GrcMilkResources.INSTANCE.textureCheeseVat);
            GrcMilkResources.INSTANCE.modelCheeseVat.render((Entity) null, 0.0f, 0.0f, 0.0f, f, 0.0f,
                    ModelCheeseVat.SCALE);
        }
        GL11.glPopMatrix();
    }
}

From source file:growthcraft.milk.client.renderer.TileEntityHangingCurdsRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
    if (te instanceof TileEntityHangingCurds) {
        final TileEntityHangingCurds hangingCurds = (TileEntityHangingCurds) te;
        GL11.glPushMatrix();/*from w  w w .j a  v  a2s.com*/
        {
            GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5f, (float) z + 0.5F);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
            this.bindTexture(GrcMilkResources.INSTANCE.textureHangingCurds);
            GrcMilkResources.INSTANCE.modelHangingCurds.setCurdColor(hangingCurds.getRenderColor())
                    .render((Entity) null, 0.0f, 0.0f, 0.0f, f, 0.0f, ModelHangingCurds.SCALE);
        }
        GL11.glPopMatrix();
    }
}

From source file:growthcraft.milk.client.renderer.TileEntityPancheonRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
    if (te instanceof TileEntityPancheon) {
        final TileEntityPancheon pancheon = (TileEntityPancheon) te;
        GL11.glPushMatrix();// ww  w  .j  ava2 s.c  o m
        {
            GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5f, (float) z + 0.5F);
            GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
            this.bindTexture(GrcMilkResources.INSTANCE.texturePancheon);
            GrcMilkResources.INSTANCE.modelPancheon.render((Entity) null, 0.0f, 0.0f, 0.0f, f, 0.0f,
                    ModelPancheon.SCALE);
        }
        GL11.glPopMatrix();
    }
}

From source file:hellfirepvp.astralsorcery.client.util.RenderingUtils.java

License:Open Source License

public static void renderLightRayEffects(double x, double y, double z, Color effectColor, long seed,
        long continuousTick, int dstJump, float scale, int countFancy, int countNormal) {
    rand.setSeed(seed);//from   www. j av a2  s  .c o  m
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);

    int fancy_count = !FMLClientHandler.instance().getClient().gameSettings.fancyGraphics ? countNormal
            : countFancy;

    Tessellator tes = Tessellator.getInstance();
    VertexBuffer vb = tes.getBuffer();

    RenderHelper.disableStandardItemLighting();
    float f1 = continuousTick / 400.0F;
    float f2 = 0.4F;

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDepthMask(false);
    GL11.glPushMatrix();
    for (int i = 0; i < fancy_count; i++) {
        GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(rand.nextFloat() * 360.0F + f1 * 360.0F, 0.0F, 0.0F, 1.0F);
        vb.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
        float fa = rand.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
        float f4 = rand.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
        fa /= 30.0F / (Math.min(dstJump, 10 * scale) / 10.0F);
        f4 /= 30.0F / (Math.min(dstJump, 10 * scale) / 10.0F);
        vb.pos(0, 0, 0).color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(),
                (int) (255.0F * (1.0F - f2))).endVertex();
        vb.pos(-0.7D * f4, fa, -0.5F * f4)
                .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex();
        vb.pos(0.7D * f4, fa, -0.5F * f4)
                .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex();
        vb.pos(0.0D, fa, 1.0F * f4)
                .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex();
        vb.pos(-0.7D * f4, fa, -0.5F * f4)
                .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex();
        tes.draw();
    }
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    RenderHelper.enableStandardItemLighting();

    GL11.glPopMatrix();
}

From source file:illarion.graphics.lwjgl.render.TextureRenderDisplaylist.java

License:Open Source License

/**
 * Draw a texture using display lists at a specified location.
 * //from w  w  w  .  j  a v  a2s  .  com
 * @param x the x coordinate of the texture
 * @param y the y coordinate of the texture
 * @param z the z coordinate (so the layer) of the texture
 * @param width the width of the area the texture shall be rendered on
 * @param height the height of the area the texture shall be rendered on
 * @param texture the texture that shall be drawn
 * @param color the color that is supposed to be used with that texture
 * @param mirror mirror the texture horizontal
 * @param rotation the value the texture is rotated by
 */
@Override
public void drawTexture(final float x, final float y, final float z, final float width, final float height,
        final TextureLWJGL texture, final SpriteColor color, final boolean mirror, final float rotation) {

    DriverSettingsLWJGL.getInstance().enableTexture(texture.getTextureID());
    color.setActiveColor();
    GL11.glPushMatrix();

    int xmod = 1;
    if (mirror) {
        xmod = -1;
        GL11.glTranslatef(x + width, y, z);
    } else {
        GL11.glTranslatef(x, y, z);
    }
    if (rotation != 0.f) {
        GL11.glRotatef(rotation, 0, 0, 1);
    }
    GL11.glScalef(width * xmod, height, 1.f);
    GL11.glTranslatef(0.5f, 0.5f, 0);

    GL11.glCallList(texture.getDisplayListID());

    GL11.glPopMatrix();
}

From source file:illarion.graphics.lwjgl.render.TextureRenderImmediate.java

License:Open Source License

/**
 * Draw a texture at a specified location using the immediate mode.
 * /*  w  w  w.ja v a  2s. c  o  m*/
 * @param x the x coordinate of the texture
 * @param y the y coordinate of the texture
 * @param z the z coordinate (so the layer) of the texture
 * @param width the width of the area the texture shall be rendered on
 * @param height the height of the area the texture shall be rendered on
 * @param texture the texture that shall be drawn
 * @param color the color that is supposed to be used with that texture
 * @param mirror mirror the texture horizontal
 * @param rotation the value the texture is rotated by
 */
@Override
public void drawTexture(final float x, final float y, final float z, final float width, final float height,
        final TextureLWJGL texture, final SpriteColor color, final boolean mirror, final float rotation) {

    DriverSettingsLWJGL.getInstance().enableTexture(texture.getTextureID());
    color.setActiveColor();

    GL11.glPushMatrix();

    int xmod = 1;
    if (mirror) {
        xmod = -1;
        GL11.glTranslatef(x + width, y, z);
    } else {
        GL11.glTranslatef(x, y, z);
    }

    GL11.glScalef(width * xmod, height, 1.f);
    GL11.glTranslatef(0.5f, 0.5f, 0);

    if (rotation != 0.f) {
        GL11.glRotatef(rotation, 0, 0, 1);
    }

    GL11.glBegin(GL11.GL_TRIANGLE_STRIP);

    if (mirror) {
        GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY2());
        GL11.glVertex2f(-0.5f, -0.5f);
        GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY1());
        GL11.glVertex2f(-0.5f, 0.5f);
        GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY2());
        GL11.glVertex2f(0.5f, -0.5f);
        GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY1());
        GL11.glVertex2f(0.5f, 0.5f);
    } else {
        GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY2());
        GL11.glVertex2f(-0.5f, -0.5f);
        GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY1());
        GL11.glVertex2f(-0.5f, 0.5f);
        GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY2());
        GL11.glVertex2f(0.5f, -0.5f);
        GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY1());
        GL11.glVertex2f(0.5f, 0.5f);
    }

    GL11.glEnd();
    GL11.glPopMatrix();
}

From source file:illarion.graphics.lwjgl.render.TextureRenderPointer.java

License:Open Source License

/**
 * Draw a texture using buffer pointers and draw arrays.
 * //from  w w  w.j  a  va2 s .  c o  m
 * @param x the x coordinate of the texture
 * @param y the y coordinate of the texture
 * @param z the z coordinate (so the layer) of the texture
 * @param width the width of the area the texture shall be rendered on
 * @param height the height of the area the texture shall be rendered on
 * @param texture the texture that shall be drawn
 * @param color the color that is supposed to be used with that texture
 * @param mirror mirror the texture horizontal
 * @param rotation the value the texture is rotated by
 */
@Override
public void drawTexture(final float x, final float y, final float z, final float width, final float height,
        final TextureLWJGL texture, final SpriteColor color, final boolean mirror, final float rotation) {

    DriverSettingsLWJGL.getInstance().enableTexturePointer(texture.getTextureID());

    color.setActiveColor();
    GL11.glPushMatrix();

    int xmod = 1;
    if (mirror) {
        xmod = -1;
        GL11.glTranslatef(x + width, y, z);
    } else {
        GL11.glTranslatef(x, y, z);
    }

    GL11.glScalef(width * xmod, height, 1.f);
    GL11.glTranslatef(0.5f, 0.5f, 0);

    if (rotation != 0.f) {
        GL11.glRotatef(rotation, 0, 0, 1);
    }

    textureBuffer.rewind();
    textureBuffer.put(texture.getRelX1()).put(texture.getRelY2());
    textureBuffer.put(texture.getRelX1()).put(texture.getRelY1());
    textureBuffer.put(texture.getRelX2()).put(texture.getRelY2());
    textureBuffer.put(texture.getRelX2()).put(texture.getRelY1());
    textureBuffer.flip();

    GL11.glTexCoordPointer(2, 0, textureBuffer);
    GL11.glVertexPointer(2, 0, vertexBuffer);

    GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, 4);

    GL11.glPopMatrix();
}