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:forestry.lepidopterology.render.ButterflyItemRenderer.java

License:Open Source License

private void renderButterflyItem(IButterfly butterfly, float translateX, float translateY, float translateZ) {
    float yaw = 1;
    float pitch = 1;

    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_LIGHTING);//from  ww w.ja  va2s .  c om
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);

    GL11.glPushMatrix();

    if (RenderItem.renderInFrame) {
        //GL11.glScalef(-2.0f, 2.0f, 2.0f);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glScalef(1.1f, 1f, 1f);

        GL11.glTranslatef(0, -0.7f, 0.2f);

        entity.renderYawOffset = 0;
        entity.rotationYaw = 0;
        entity.rotationPitch = 0;
        entity.rotationYawHead = entity.rotationYaw;

        RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0f);

    } else {
        GL11.glTranslatef(translateX, translateY, translateZ);

        GL11.glScalef(-2.0f, 2.0f, 2.0f);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-((float) Math.atan((double) (pitch / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);

        entity.renderYawOffset = (float) Math.atan((double) (yaw / 40.0F)) * 20.0F;
        entity.rotationYaw = (float) Math.atan((double) (yaw / 40.0F)) * 40.0F;
        entity.rotationPitch = -((float) Math.atan((double) (pitch / 40.0F))) * 20.0F;
        entity.rotationYawHead = entity.rotationYaw;

        RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, getWingYaw(butterfly));

    }

    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.glPopAttrib();

}

From source file:forestry.lepidopterology.render.ButterflyItemRenderer.java

License:Open Source License

private void renderButterflyInInventory(IButterfly butterfly) {

    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_LIGHTING);//from w ww  .  j  ava 2 s  .co  m
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    RenderHelper.enableStandardItemLighting();
    GL11.glPushMatrix();

    GL11.glTranslatef(0f, -0.75f, 0f);
    GL11.glScalef(-2.0f, 2.0f, 2.0f);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-35.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(1.1f, 1f, 1f);

    entity.renderYawOffset = 0;
    entity.rotationYaw = 0;
    entity.rotationPitch = 0;
    entity.rotationYawHead = entity.rotationYaw;

    RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, getWingYaw(butterfly));

    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.glPopAttrib();

}

From source file:fr.def.iss.vd2.lib_v3d.camera.V3DSimple2DCamera.java

License:Open Source License

@Override
protected void configureView(GLU glu) {

    if (lastWidth != currentWidth || lastHeight != currentHeight) {
        fireZoomChanged();//from  w w w  .j a v a  2 s.  co m
    }
    lastWidth = currentWidth;
    lastHeight = currentHeight;

    GL11.glRotatef(-90, 0, 0, 1.0f);
    GL11.glRotatef(rotation, 0, 0, 1.0f);

    glu.gluLookAt(position.x, position.y, 0, position.x, position.y, -200, 1, 0, 0);

}

From source file:fr.def.iss.vd2.lib_v3d.camera.V3DSimple2DCamera.java

License:Open Source License

@Override
public void disableRotation() {
    GL11.glPushMatrix();
    GL11.glRotatef(-rotation, 0, 0, 1.0f);
}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DElement.java

License:Open Source License

/**
 * Internal public method Mthode principal du rendu d'un lment. Cette
 * mthode appelle le code de rendu spcifique de l'lment via la mthode
 * doDisplay si ncessaire.// w w w .jav a 2  s . c o m
 * 
 * @param gl
 *            context gl du rendu
 * @param camera
 *            point de vue
 */
final public void display(V3DCamera camera) {
    if (!visible) {
        return;
    }

    if (!inited) {
        init();
    }

    GL11.glPushMatrix();
    if (transformMatrix != null) {
        GL11.glMultMatrix(transformMatrix);
    } else {
        if (rotation.x != 0) {
            GL11.glRotatef(rotation.x, 1, 0, 0);
        }
        if (rotation.y != 0) {
            GL11.glRotatef(rotation.y, 0, 1, 0);
        }
        if (rotation.z != 0) {
            GL11.glRotatef(rotation.z, 0, 0, 1);
        }

        if (position.x != 0 || position.y != 0 || position.z != 0) {
            GL11.glTranslatef(position.x, position.y, position.z);
        }
    }

    if (scale.x != 1 || scale.y != 1 || scale.z != 1) {
        GL11.glScalef(scale.x, scale.y, scale.z);
    }

    animation.preDisplay();

    if (animation.doDisplay()) {

        if (showShape) {
            doDisplay(camera);
        }

        if (showBoundingBox) {
            getBoundingBox().display();
        }
    }
    animation.postDisplay();

    GL11.glPopMatrix();
}

From source file:fr.def.iss.vd2.lib_v3d.element.V3DElement.java

License:Open Source License

/**
 * Internal public method Mthode principal du rendu de selection d'un
 * lment. Cette mthode appelle le code de rendu de selection spcifique
 * de l'lment via la mthode doSelect si ncessaire. Les animations
 * n'entrent pas en jeu dans le rendu de selection.
 * /*  ww  w  . j a  va 2  s.c om*/
 * @param gl
 *            context gl du rendu de selection
 * @param camera
 *            point de vue
 */
final public void select(V3DCamera camera, long parentId) {

    if (!inited) {
        init();
    }

    if (!isTangible() || !showShape) {
        return;
    }

    GL11.glPushMatrix();

    // TODO: verify this cast. Maybe change id from long to int
    if (selectable) {
        GL11.glLoadName((int) id);
    }

    if (rotation.x != 0) {
        GL11.glRotatef(rotation.x, 1, 0, 0);
    }
    if (rotation.y != 0) {
        GL11.glRotatef(rotation.y, 0, 1, 0);
    }
    if (rotation.z != 0) {
        GL11.glRotatef(rotation.z, 0, 0, 1);
    }

    if (position.x != 0 || position.y != 0 || position.z != 0) {
        GL11.glTranslatef(position.x, position.y, position.z);
    }

    if (scale.x != 1 || scale.y != 1 || scale.z != 1) {
        GL11.glScalef(scale.x, scale.y, scale.z);
    }

    if (selectable) {
        doSelect(camera, id);
    } else {
        doSelect(camera, parentId);
    }

    if (selectable) {
        GL11.glLoadName((int) parentId);
    }

    GL11.glPopMatrix();

}

From source file:fr.mcnanotech.kevin_68.nanotechmod.city.client.renderer.tileentity.TileEntityLampLightRender.java

License:Creative Commons License

public void renderTileEntityAtBlockLamp(TileEntityLampLight tileentity, double x, double y, double z,
        float scale) {
    GL11.glPushMatrix();//from  ww  w .ja  v a2  s .co m
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    this.bindTexture(new ResourceLocation(tileentity.getLampTexture));
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    this.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
}

From source file:fr.mcnanotech.kevin_68.nanotechmod.city.client.renderer.tileentity.TileEntityLampRender.java

License:Creative Commons License

public void renderTileEntityAtBlockLamp(TileEntityLamp tileentity, double x, double y, double z, float scale) {
    GL11.glPushMatrix();/*from w ww .  j  av a  2s  .  co m*/
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    this.bindTexture(texture);
    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    this.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
}

From source file:fr.mcnanotech.kevin_68.nanotechmod.city.client.renderer.tileentity.TileEntityModernFenceRender.java

License:Creative Commons License

public void renderTileEntityAtBlockModernFenceBase(TileEntityModernFence tileentity, double x, double y,
        double z, float scale) {
    GL11.glPushMatrix();//  ww w  . j  a v a 2 s  .c om
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    this.bindTexture(texture2);
    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(0F, 0.0F, 1.0F, 0.0F);
    this.model2.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
    GL11.glPopMatrix();
}

From source file:fr.mcnanotech.kevin_68.nanotechmod.city.client.renderer.tileentity.TileEntityModernFenceRender.java

License:Creative Commons License

public void renderTileEntityAtBlockModernFence(TileEntityModernFence tileentity, double x, double y, double z,
        float scale, float angle) {
    GL11.glPushMatrix();/*from w  ww  .  j ava2  s .  com*/
    GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
    this.bindTexture(texture);
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
    this.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
}