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:net.maxiebyte.voxel.Main1.java

License:Open Source License

public void run() throws Exception {
    double rotation = 0;
    double x = 0;
    double y = 0;
    double z = -8;
    VoxelContext context = new VoxelContext();
    new DefaultInit(context).init();
    context.registerBlock(new BlockType("test:diamond", context).setColour(new GLColor(0, 0, 1, 0.8)));
    context.registerBlock(new BlockType("test:gold", context).setColour(new GLColor(0.8, 0.8, 0.8, 0.96)));
    Utils.initClient();//from  w w  w.j  a  v  a 2s  .  c  o m
    World world = new DefaultWorld(context, Paths.get("target"));
    world.loadChunk(0, 0);
    new SphereGen(16, (sworld, sx, sy, sz) -> sworld.setBlockAt(sx, sy, sz,
            context.blockRegistry.getObject("default:stone"))).generate(world, 0, 20, 0, null);
    BlockType[] blocks = new BlockType[] { context.blockRegistry.getObject("default:stone"),
            context.blockRegistry.getObject("default:dirt"), context.blockRegistry.getObject("default:grass") };
    for (int k = 0; k < 16 / 2; k++) {
        for (int i = k; i < 16 - k; i++) {
            for (int j = k; j < 16 - k; j++) {
                world.setBlockAt(i, k, j, blocks[k % blocks.length]);
            }
        }
    }

    for (int i = 3; i < 14; i++) {
        for (int j = 3; j < 14; j++) {
            world.setBlockAt(i, 3, j, context.blockRegistry.getObject("default:grass"));
        }
    }
    while (!Display.isCloseRequested()) {
        Keyboard.poll();
        if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
            x += (double) 1 / 20;
        }
        if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
            x -= (double) 1 / 20;
        }
        if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
            y -= (double) 1 / 5;
        }
        if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
            y += (double) 1 / 5;
        }
        if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
            z += (double) 1 / 20;
        }
        if (Keyboard.isKeyDown(Keyboard.KEY_Z)) {
            z -= (double) 1 / 20;
        }
        if (Keyboard.isKeyDown(Keyboard.KEY_0)) {
            rotation += (double) 1 / 2;
        }
        if (Keyboard.isKeyDown(Keyboard.KEY_1)) {
            rotation -= (double) 1 / 2;
        }
        context.clientLoopInnerStart();
        GL11.glTranslated(x, y, z);
        GL11.glRotated(rotation, 0, 1, 0);
        context.renderWorld(world, (chunk) -> true);
        context.clientLoopInnerEnd();
    }
    Utils.destroyClient();
}

From source file:net.quetzi.bluepower.api.part.BPPartFace.java

License:Open Source License

public void rotateAndTranslateDynamic(Vector3 loc, int pass, float frame) {

    GL11.glTranslated(loc.getX(), loc.getY(), loc.getZ());

    GL11.glTranslated(0.5, 0.5, 0.5);//from  w  w  w .j a v  a  2 s.c o  m
    {

        switch (getFace()) {
        case 0:
            GL11.glRotated(180, 1, 0, 0);
            break;
        case 1:
            break;
        case 2:
            GL11.glRotated(90, 1, 0, 0);
            break;
        case 3:
            GL11.glRotated(90, -1, 0, 0);
            break;
        case 4:
            GL11.glRotated(90, 0, 0, -1);
            break;
        case 5:
            GL11.glRotated(90, 0, 0, 1);
            break;
        }
        GL11.glRotated(90 * (rotation == 0 || rotation == 2 ? (rotation + 2) % 4 : rotation), 0, 1, 0);
    }
    GL11.glTranslated(-0.5, -0.5, -0.5);
}

From source file:net.quetzi.bluepower.part.gate.GateBase.java

License:Open Source License

@Override
public final void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    GL11.glPushMatrix();// w w  w .  ja va  2 s.c  o m
    {

        if (type == ItemRenderType.INVENTORY) {
            GL11.glTranslated(0, 0.5, 0);
            GL11.glRotated(-12, -1, 0, 1);
        }

        /* Top */
        renderTop();

        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/bottom.png"));
        GL11.glBegin(GL11.GL_QUADS);
        /* Bottom */
        GL11.glNormal3d(0, -1, 0);
        RenderHelper.addVertexWithTexture(0, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(1, 0, 0, 1, 0);
        RenderHelper.addVertexWithTexture(1, 0, 1, 1, 1);
        RenderHelper.addVertexWithTexture(0, 0, 1, 0, 1);
        GL11.glEnd();
        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/side.png"));
        GL11.glBegin(GL11.GL_QUADS);
        /* East */
        GL11.glNormal3d(1, 0, 0);
        RenderHelper.addVertexWithTexture(1, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 0, 1, 0);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 1, 1, 1);
        RenderHelper.addVertexWithTexture(1, 0, 1, 0, 1);
        /* West */
        GL11.glNormal3d(-1, 0, 0);
        RenderHelper.addVertexWithTexture(0, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(0, 0, 1, 0, 1);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 1, 1, 1);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 0, 1, 0);
        /* North */
        GL11.glNormal3d(0, 0, -1);
        RenderHelper.addVertexWithTexture(0, 0, 0, 0, 0);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 0, 1, 0);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 0, 1, 1);
        RenderHelper.addVertexWithTexture(1, 0, 0, 0, 1);
        /* South */
        GL11.glNormal3d(0, 0, 1);
        RenderHelper.addVertexWithTexture(0, 0, 1, 0, 0);
        RenderHelper.addVertexWithTexture(1, 0, 1, 0, 1);
        RenderHelper.addVertexWithTexture(1, 1D / 8D, 1, 1, 1);
        RenderHelper.addVertexWithTexture(0, 1D / 8D, 1, 1, 0);
        GL11.glEnd();
    }
    GL11.glPopMatrix();
}

From source file:nightkosh.gravestone_extended.models.block.ModelPileOfBones.java

License:LGPL

public void renderAll(boolean haveSkull) {
    float f5 = 0.0625F;
    bone1.render(f5);// w ww . j a  v  a  2 s . c  o  m
    bone2.render(f5);
    bone3.render(f5);
    bone4.render(f5);
    bone5.render(f5);
    bone6.render(f5);
    bone7.render(f5);
    bone8.render(f5);

    if (haveSkull) {
        Minecraft.getMinecraft().renderEngine.bindTexture(Resources.SKELETON_SKULL_CANDLE);
        GL11.glPushMatrix();
        GL11.glTranslated(0.4, 0, 0.5);
        GL11.glRotated(45, 0, 1, 0);
        skull.renderWithTexture(f5, false);
        GL11.glPopMatrix();
    }
}

From source file:nightkosh.gravestone_extended.models.block.ModelSpawnerPentagram.java

License:LGPL

public void renderAll() {
    pentagram.render(0.0625F);//  w w  w  . j  a va  2  s. c  o  m

    GL11.glPushMatrix();
    GL11.glTranslated(0, 0, 1);
    GL11.glRotated(180, 0, 1, 0);
    candle1.renderAll(skullType);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.95, 0, 0.3);
    GL11.glRotated(252, 0, 1, 0);
    candle2.renderAll(skullType);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-0.95, 0, 0.3);
    GL11.glRotated(108, 0, 1, 0);
    candle3.renderAll(skullType);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-0.59, 0, -0.8);
    GL11.glRotated(36, 0, 1, 0);
    candle4.renderAll(skullType);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.61, 0, -0.8);
    GL11.glRotated(-36, 0, 1, 0);
    candle5.renderAll(skullType);
    GL11.glPopMatrix();
}

From source file:org.evilco.mc.defense.client.renderer.tile.generic.DefenseStationTileEntityRenderer.java

License:Apache License

/**
 * {@inheritDoc}//from  w  w w . j  av a 2  s . c om
 */
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) {
    GL11.glPushMatrix();

    GL11.glTranslatef(((float) var2), ((float) var4), ((float) var6));
    GL11.glTranslatef(0.5f, 1.5f, 0.5f);
    GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);

    GL11.glRotated(((IRotateableTileEntity) var1).getRotationAngle(), 0f, 1f, 0f);

    // cast entity
    DefenseStationTileEntity defenseStationTileEntity = ((DefenseStationTileEntity) var1);

    GL11.glPushMatrix();
    this.bindTexture(new ResourceLocation("defense",
            "textures/blocks/generic/defenseStation" + (defenseStationTileEntity.getTier() == 1 ? "Advanced"
                    : (defenseStationTileEntity.getTier() == 2 ? "Expert" : "")) + ".png"));
    model.render(null, 0.0f, 0.0f, -0.1f, 0.0f, 0.0f, 0.062f);
    GL11.glPopMatrix();

    GL11.glPopMatrix();
}

From source file:org.evilco.mc.defense.client.renderer.tile.machine.RollingMillTileEntityRenderer.java

License:Apache License

/**
 * {@inheritDoc}// w  ww  .j  a v  a  2  s . c om
 */
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) {
    GL11.glPushMatrix();

    GL11.glTranslatef(((float) var2), ((float) var4), ((float) var6));
    GL11.glTranslatef(0.5f, 1.5f, 0.5f);
    GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);

    GL11.glRotated(((IRotateableTileEntity) var1).getRotationAngle(), 0f, 1f, 0f);

    GL11.glPushMatrix();
    this.bindTexture(new ResourceLocation("defense", "textures/blocks/machine/rollingMill.png"));
    model.render(null, 0.0f, 0.0f, -0.1f, 0.0f, 0.0f, 0.062f);
    model.renderDrums(null, 0.0f, 0.0f, -0.1f, 0.0f, 0.0f, 0.062f,
            ((RollingMillTileEntity) var1).getDrumRotation(var8));
    if (((RollingMillTileEntity) var1).isProcessing())
        model.renderItem(null, 0.0f, 0.0f, -0.1f, 0.0f, 0.0f, 0.062f);
    GL11.glPopMatrix();

    GL11.glPopMatrix();
}

From source file:org.evilco.mc.defense.client.renderer.tile.sensor.CameraTileEntityRenderer.java

License:Apache License

/**
 * {@inheritDoc}/*w w w.j av  a2s. c om*/
 */
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) {
    GL11.glPushMatrix();

    GL11.glTranslatef(((float) var2), ((float) var4), ((float) var6));
    GL11.glTranslatef(0.5f, 1.5f, 0.5f);
    GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);

    GL11.glRotated(((IRotateableTileEntity) var1).getRotationAngle(), 0f, 1f, 0f);

    GL11.glPushMatrix();
    this.bindTexture(new ResourceLocation("defense", "textures/blocks/sensor/camera"
            + (((ISurveillanceNetworkSensor) var1).isConnected() ? "Active" : "") + ".png"));
    model.render(null, 0.0f, 0.0f, -0.1f, 0.0f, 0.0f, 0.062f, ((CameraTileEntity) var1).getCameraAngle(var8));
    GL11.glPopMatrix();

    GL11.glPopMatrix();
}

From source file:org.evilco.mc.defense.client.renderer.tile.trigger.MotionDetectorTileEntityRenderer.java

License:Apache License

/**
 * {@inheritDoc}// w  w w .j a v a2 s .  co m
 */
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) {
    GL11.glPushMatrix();

    GL11.glTranslatef(((float) var2), ((float) var4), ((float) var6));
    GL11.glTranslatef(0.5f, 1.5f, 0.5f);
    GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);

    GL11.glRotated(((IRotateableTileEntity) var1).getRotationAngle(), 0f, 1f, 0f);

    GL11.glPushMatrix();
    this.bindTexture(new ResourceLocation("defense", "textures/blocks/trigger/motionDetector"
            + (((MotionDetectorTileEntity) var1).isConnected() ? "" : "Inactive") + ".png"));
    model.render(null, 0.0f, 0.0f, -0.1f, 0.0f, 0.0f, 0.062f);
    GL11.glPopMatrix();

    GL11.glPopMatrix();
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glRotated(double a, double b, double c, double d) {
    GL11.glRotated(a, b, c, d);
}