Example usage for org.lwjgl.opengl GL11 glRotated

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

Introduction

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

Prototype

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

Source Link

Document

Double version of #glRotatef Rotatef .

Usage

From source file:cn.academy.ability.electro.client.render.entity.RenderArcEff.java

License:Open Source License

@Override
protected void firstTranslate(Entity ent) {
    EntityArcS arc = (EntityArcS) ent;
    GL11.glRotated(arc.roll, 0, 0, 1);
}

From source file:cn.academy.ability.electro.client.render.entity.RenderElecArc.java

License:Open Source License

@Override
protected void drawPerBillboard(EntityArcBase ent, int i) {
    GL11.glRotated(ent.getRotation(i), 0, 0, 1);
}

From source file:cn.academy.ability.electro.client.render.skill.RailgunPlaneEffect.java

License:Open Source License

@SideOnly(Side.CLIENT)
@Override//from   w  w  w.  ja  v a2  s.c o  m
public void renderHandEffect(EntityPlayer player, HandRenderType type, long dt) {
    if (type == HandRenderType.EQUIPPED)
        return;
    if (dt < DELAY)
        return;
    dt -= DELAY;

    double tz = dt * dt / 3e4;
    double TRANS_TIME = ANIM_LEN * 0.2;
    double alpha = (dt < TRANS_TIME ? dt / TRANS_TIME
            : (dt > ANIM_LEN - TRANS_TIME ? (ANIM_LEN - dt) / TRANS_TIME : 1));

    //Draw a screen-filling blackout
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GLU.gluOrtho2D(0, 255, 0, 255);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glDepthMask(false);
    GL11.glLoadIdentity();
    {
        GL11.glTranslated(0, 0, 0);
        GL11.glColor4d(0, 0, 0, 0.2 * alpha);
        HudUtils.setZLevel(1);
        HudUtils.drawModalRect(0, 0, 255, 255);
        HudUtils.setZLevel(-90);
    }
    GL11.glDepthMask(true);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glMatrixMode(GL11.GL_MODELVIEW); //Restore the matrix

    //Draw the real effect

    GL11.glColor4d(1, 1, 1, alpha * 0.6);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.0f);
    GL11.glPushMatrix();
    {
        GL11.glTranslated(-.4, 0.85 + tz * 0.37, tz);
        GL11.glRotated(-20.4, 1, 0, 0);

        drawSingleSide(7);

        //         GL11.glPushMatrix(); {
        //            GL11.glTranslated(-2.3, 0, 0);
        //            drawSingleSide(7);
        //         } GL11.glPopMatrix();
    }
    GL11.glPopMatrix();

    GL11.glDisable(GL11.GL_ALPHA_TEST);
}

From source file:cn.academy.ability.electro.client.render.skill.SRSmallCharge.java

License:Open Source License

@Override
public void draw() {
    GL11.glDisable(GL11.GL_CULL_FACE);/*from  w w  w  . j a v  a2s .c  om*/
    GL11.glDepthMask(false);
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4d(1, 1, 1, 0.7);

    GL11.glTranslated(0, 0.9, 0.2);
    GL11.glRotated(120, 1, 0, 0);
    GL11.glScaled(0.5, 0.5, 0.5);
    //RenderUtils.drawCube(1, 1, 2);
    for (ArcObject arc : arcs) {
        arc.draw();
    }

    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:cn.academy.ability.teleport.client.render.entity.MarkRender.java

License:Open Source License

@Override
public void doRender(Entity ent, double x, double y, double z, float var8, float var9) {
    EntityTPMarking mark = (EntityTPMarking) ent;
    int texID = (int) ((mark.ticksExisted / 2.5) % tex.length);

    GL11.glEnable(GL11.GL_BLEND);/*w  ww.  j  av a2  s  . co m*/
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glPushMatrix();
    {
        GL11.glTranslated(x, y, z);

        GL11.glRotated(-mark.rotationYaw, 0, 1, 0);
        GL11.glScaled(-1, -1, 1);
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
        Tessellator.instance.setBrightness(15728880);
        RenderUtils.loadTexture(tex[texID]);
        model.draw();
    }
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:cn.academy.core.client.ACRenderingHelper.java

License:GNU General Public License

/**
 * Draws a circular progress bar at (0, 0) with radius 1
 *///  w w  w . jav  a  2s  . c  o m
public static void drawCircularProgbar(ResourceLocation texture, double progress) {

    progress *= 360;
    if (progress > 360)
        progress %= 360;

    Tessellator t = Tessellator.instance;

    GL11.glPushMatrix();
    RenderUtils.loadTexture(texture);
    for (int i = 0; i < 4; ++i) {
        double angle = Math.min(90, progress - 90 * i);
        if (angle <= 0)
            break;
        double u1, v1;
        t.startDrawing(GL11.GL_TRIANGLES);

        if (angle <= 45) {
            u1 = Math.tan(MathUtils.toRadians(angle));
            v1 = 0;
        } else {
            u1 = 1;
            v1 = 0;

            double x = Math.tan(MathUtils.toRadians(90 - angle));
            t.addVertexWithUV(1, -1, 0, 1, 0);
            t.addVertexWithUV(0, 0, 0, 0, 1);
            t.addVertexWithUV(1, -x, 0, 1, 1 - x);
        }

        t.addVertexWithUV(0, -1, 0, 0, 0);
        t.addVertexWithUV(0, 0, 0, 0, 1);
        t.addVertexWithUV(u1, -1 - v1, 0, u1, v1);
        t.draw();

        GL11.glRotated(90, 0, 0, 1);
    }
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:cn.academy.core.client.ACRenderingHelper.java

License:GNU General Public License

private static void dirQuad(double x0, double y0, double x1, double y1, float width) {
    float hw = width / 2;
    Tessellator t = Tessellator.instance;
    double dy = y1 - y0, dx = x1 - x0, len = Math.sqrt(dy * dy + dx * dx);
    double theta = MathUtils.toDegrees(Math.atan2(dy, dx));

    GL11.glPushMatrix();//from  w w w. j  a  v  a 2  s.  c  o m
    GL11.glTranslated(x0, y0, 0);
    GL11.glRotated(theta, 0, 0, 1);
    t.startDrawingQuads();
    t.addVertexWithUV(0, -hw, 0, 0, 0);
    t.addVertexWithUV(0, hw, 0, 0, 1);
    t.addVertexWithUV(len, hw, 0, 1, 1);
    t.addVertexWithUV(len, -hw, 0, 1, 0);
    t.draw();
    GL11.glPopMatrix();
}

From source file:cn.academy.core.client.gui.dev.PageMain.java

License:Open Source License

private void drawPlayer() {
    EntityPlayer player = dev.user;// ww w . j a  va  2s.  c  om
    RenderUtils.loadTexture(RenderUtils.STEVE_TEXTURE);
    float x = 100, y = 100, scale = 2.1F;
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glPushMatrix();
    {
        GL11.glTranslatef(183, 58, 100F);
        GL11.glScalef((-scale), scale, scale);
        GL11.glRotated(-25, 1, 0, 0);
        RenderHelper.enableStandardItemLighting();
        GL11.glRotatef(Minecraft.getSystemTime() / 100F, 0F, 1F, 0F); //Rotate around Y
        model.render(player, 0, 0, 0, 0, 0, 1F);
    }
    GL11.glPopMatrix();
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    GL11.glDepthFunc(GL11.GL_ALWAYS);
}

From source file:cn.academy.core.client.render.ACModelBiped.java

License:Open Source License

@Override
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) {
    GL11.glPushMatrix();//from  www. ja  v a  2  s .c  om
    {
        if (par1Entity == Minecraft.getMinecraft().thePlayer) {
            GL11.glPopMatrix();
            return;
        }
        //System.out.println(DebugUtils.formatArray(par2, par3, par4, par5, par6, par7));
        GL11.glTranslated(0, 1, 0);
        GL11.glRotated(180, 0, 1, 0);
        GL11.glRotated(90, 1, 0, 0);
        GL11.glRotated(180, 0, 1, 0);
        super.render(par1Entity, par2, par3, par4, par5, par6, par7);
    }
    GL11.glPopMatrix();
}

From source file:cn.academy.core.client.render.ray.RendererRayBaseSimple.java

License:GNU General Public License

@Override
public void doRender(Entity ent, double x, double y, double z, float a, float b) {
    IRay ray = (IRay) ent;/*from w w w  .ja  v  a 2s  .  c o m*/

    GL11.glPushMatrix();

    double length = ray.getLength();
    double fix = ray.getStartFix();

    Vec3 vo;
    if (ray.needsViewOptimize())
        vo = ViewOptimize.getFixVector(ray);
    else
        vo = vec(0, 0, 0);
    // Rotate fix vector to world coordinate
    vo.rotateAroundY(MathUtils.toRadians(270 - ent.rotationYaw));

    Vec3 start = vec(0, 0, 0), end = add(start, multiply(new Motion3D(ent, true).getMotionVec(), length));
    start = add(start, vo);

    x += start.xCoord;
    y += start.yCoord;
    z += start.zCoord;

    Vec3 delta = subtract(end, start);
    double dxzsq = delta.xCoord * delta.xCoord + delta.zCoord * delta.zCoord;
    double npitch = MathUtils.toDegrees(Math.atan2(delta.yCoord, Math.sqrt(dxzsq)));
    double nyaw = MathUtils.toDegrees(Math.atan2(delta.xCoord, delta.zCoord));

    GL11.glTranslated(x, y, z);
    GL11.glRotated(-90 + nyaw, 0, 1, 0);
    GL11.glRotated(npitch, 0, 0, 1);
    GL11.glTranslated(fix, 0, 0);
    draw(ent, ray.getLength() - fix);

    GL11.glPopMatrix();
}