Example usage for org.lwjgl.opengl GL11 GL_MODELVIEW

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

Introduction

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

Prototype

int GL_MODELVIEW

To view the source code for org.lwjgl.opengl GL11 GL_MODELVIEW.

Click Source Link

Document

MatrixMode

Usage

From source file:de.sanandrew.core.manpack.util.client.helpers.ItemRenderHelper.java

License:Creative Commons License

private static void renderItemIn3D(IIcon icon, boolean withEffect, int spriteIndex) {
    GL11.glPushMatrix();/*from  w  ww.  j  a  v a2  s.c o  m*/

    if (icon == null) {
        GL11.glPopMatrix();
        return;
    }

    float minU = icon.getMinU();
    float maxU = icon.getMaxU();
    float minV = icon.getMinV();
    float maxV = icon.getMaxV();

    Tessellator tessellator = Tessellator.instance;

    Minecraft.getMinecraft().renderEngine
            .bindTexture(Minecraft.getMinecraft().renderEngine.getResourceLocation(spriteIndex));

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F,
            false);

    if (withEffect) {
        float baseClr = 0.76F;
        float glintScale = 0.125F;
        float glintTransX = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F;

        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);

        Minecraft.getMinecraft().renderEngine.bindTexture(GLINT_PNG);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        GL11.glColor4f(0.5F * baseClr, 0.25F * baseClr, 0.8F * baseClr, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);
        GL11.glTranslatef(glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);

        glintTransX = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F;

        GL11.glTranslatef(-glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.core.manpack.util.client.helpers.ItemRenderHelper.java

License:Creative Commons License

/**
 * Renders an IIcon in 2D./*  w  w w.j  a  va2  s.com*/
 *
 * @param icon        the icon to be rendered
 * @param spriteIndex the index of the texture to be used (0 = blocks, 1 = items)
 * @param hasEffect   if it has an enchantment effect
 * @param isGlowing   if it should glow in the dark
 */
public static void renderIcon(IIcon icon, int spriteIndex, boolean hasEffect, boolean isGlowing) {
    GL11.glPushMatrix();

    if (icon == null) {
        GL11.glPopMatrix();
        return;
    }

    float minU = icon.getMinU();
    float maxU = icon.getMaxU();
    float minV = icon.getMinV();
    float maxV = icon.getMaxV();
    float transX = 0.0F;
    float transY = 0.3F;
    float scale = 1.5F;
    Tessellator tessellator = Tessellator.instance;

    Minecraft.getMinecraft().renderEngine
            .bindTexture(Minecraft.getMinecraft().renderEngine.getResourceLocation(spriteIndex));

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(-transX, -transY, 0.0F);
    GL11.glScalef(scale, scale, scale);
    GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);

    renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F,
            isGlowing);

    if (hasEffect) {
        float baseClr = 0.76F;
        float glintScale = 0.125F;
        float glintTransX = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F;

        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);

        Minecraft.getMinecraft().renderEngine.bindTexture(GLINT_PNG);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        GL11.glColor4f(0.5F * baseClr, 0.25F * baseClr, 0.8F * baseClr, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);
        GL11.glTranslatef(glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(glintScale, glintScale, glintScale);

        glintTransX = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F;

        GL11.glTranslatef(-glintTransX, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);

        renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false);

        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.turretmod.client.event.RenderForcefieldHandler.java

License:Creative Commons License

@SubscribeEvent(priority = EventPriority.HIGH)
public void onRenderWorldLast(RenderWorldLastEvent event) {
    Minecraft mc = Minecraft.getMinecraft();
    Entity renderEntity = mc.getRenderViewEntity();
    if (renderEntity == null) {
        return;/* w w w  . j  a v a  2 s.co m*/
    }

    final float partialTicks = event.getPartialTicks();
    double renderX = renderEntity.lastTickPosX + (renderEntity.posX - renderEntity.lastTickPosX) * partialTicks;
    double renderY = renderEntity.lastTickPosY + (renderEntity.posY - renderEntity.lastTickPosY) * partialTicks;
    double renderZ = renderEntity.lastTickPosZ + (renderEntity.posZ - renderEntity.lastTickPosZ) * partialTicks;

    List<ForcefieldCube> cubes = new ArrayList<>();

    int worldTicks = (int) (mc.world.getTotalWorldTime() % Integer.MAX_VALUE);

    Iterator<Map.Entry<Integer, Queue<IForcefieldProvider>>> it = this.fieldProviders.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry<Integer, Queue<IForcefieldProvider>> entry = it.next();
        Entity entity = mc.world.getEntityByID(entry.getKey());

        if (entity == null || entry.getValue().size() < 1) {
            it.remove();
            continue;
        }

        Iterator<IForcefieldProvider> itFF = entry.getValue().iterator();
        while (itFF.hasNext()) {
            IForcefieldProvider ffProvider = itFF.next();

            ColorObj color = new ColorObj(ffProvider.getShieldColor());

            double entityX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks;
            double entityY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks;
            double entityZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks;

            ForcefieldCube cube = new ForcefieldCube(
                    new Vec3d(entityX - renderX, entityY - renderY, entityZ - renderZ),
                    ffProvider.getShieldBoundingBox(), color);
            cube.fullRendered = ffProvider.renderFull();

            if (entity.isDead || !entity.isEntityAlive() || !ffProvider.isShieldActive()
                    || !mc.world.loadedEntityList.contains(entity)) {
                if (ffProvider.hasSmoothFadeOut()) {
                    this.fadeOutFields.add(cube);
                }
                itFF.remove();
            } else {
                if (TmrConfiguration.calcForcefieldIntf) {
                    for (ForcefieldCube intfCube : cubes) {
                        cube.interfere(intfCube, false);
                        intfCube.interfere(cube, true);
                    }
                }

                cubes.add(cube);
            }
        }
    }

    Iterator<ForcefieldCube> fadeOutIt = this.fadeOutFields.iterator();
    while (fadeOutIt.hasNext()) {
        ForcefieldCube shield = fadeOutIt.next();
        if (shield.boxColor.alpha() <= 0) {
            fadeOutIt.remove();
        } else {
            cubes.add(shield);

            shield.boxColor.setAlpha(shield.boxColor.alpha() - 3);
        }
    }

    Tessellator tess = Tessellator.getInstance();
    for (int pass = 1; pass <= 5; pass++) {
        float transformTexAmount = worldTicks % 400 + event.getPartialTicks();
        float texTranslateX = 0.0F;
        float texTranslateY = 0.0F;

        switch (pass) {
        case 1:
            texTranslateX = transformTexAmount * -0.01F;
            texTranslateY = transformTexAmount * 0.01F;
            mc.renderEngine.bindTexture(Resources.TURRET_FORCEFIELD_P1.getResource());
            break;
        case 2:
            texTranslateX = transformTexAmount * 0.005F;
            texTranslateY = transformTexAmount * 0.005F;
            mc.renderEngine.bindTexture(Resources.TURRET_FORCEFIELD_P2.getResource());
            break;
        case 3:
            texTranslateX = transformTexAmount * -0.005F;
            texTranslateY = transformTexAmount * 0.005F;
            mc.renderEngine.bindTexture(Resources.TURRET_FORCEFIELD_P1.getResource());
            break;
        case 4:
            texTranslateX = transformTexAmount * 0.0025F;
            texTranslateY = transformTexAmount * 0.0025F;
            mc.renderEngine.bindTexture(Resources.TURRET_FORCEFIELD_P2.getResource());
            break;
        case 5:
            texTranslateX = transformTexAmount * 0.00F;
            texTranslateY = transformTexAmount * 0.00F;
            mc.renderEngine.bindTexture(Resources.TURRET_FORCEFIELD_P3.getResource());
            break;
        }

        GlStateManager.matrixMode(GL11.GL_TEXTURE);
        GlStateManager.loadIdentity();
        GlStateManager.translate(texTranslateX, texTranslateY, 0.0F);
        GlStateManager.matrixMode(GL11.GL_MODELVIEW);

        GlStateManager.enableBlend();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.CONSTANT_ALPHA,
                GlStateManager.DestFactor.ONE_MINUS_CONSTANT_ALPHA);

        for (ForcefieldCube cube : cubes) {
            tess.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);

            cube.draw(tess);

            GL14.glBlendColor(1.0f, 1.0f, 1.0f, cube.boxColor.fAlpha() * 0.5F);
            GlStateManager.depthMask(false);
            GlStateManager.disableCull();
            tess.draw();
            GlStateManager.enableCull();
            GlStateManager.depthMask(true);
            GL14.glBlendColor(1.0F, 1.0F, 1.0F, 1.0F);
        }

        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA,
                GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.disableBlend();

        GlStateManager.matrixMode(GL11.GL_TEXTURE);
        GL11.glLoadIdentity();
        GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    }
}

From source file:displayexample.DisplayExample.java

public void start() {
    x = 15;//  ww  w  .  j  a  v  a2  s.c  om
    y = 15;
    try {
        Display.setTitle("Exemple de fentre !");
        Display.setDisplayMode(new DisplayMode(800, 600));
        Display.create();

    } catch (LWJGLException e) {
        e.printStackTrace();
        System.exit(0);
    }
    box = new Box2D(30.0f, 50.0f, 25.0f);
    box.setUp();
    // init OpenGL here
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, 800, 0, 600, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    while (!Display.isCloseRequested() && !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {

        // render OpenGL here

        box.draw();
        pollInput();

        Display.update();
        Display.sync(60);
    }

    Display.destroy();
    System.exit(0);
}

From source file:dripdisplay.DripDisplayLWJGL.java

protected void initGLLWJGL() {

    if (!LEVEL_EDITOR) {
        GL11.glViewport(0, 0, 800, 600);
    } else {/*from   w w  w .  ja va 2 s .com*/
        GL11.glViewport(0, 0, 1000, 800);
    }
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    if (!LEVEL_EDITOR) {
        GL11.glOrtho(0, 800, 600, 0, 1, -1);
    } else {
        GL11.glOrtho(0, 1000, 800, 0, 1, -1);
    }
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    initTextures();
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    createModel();
}

From source file:edu.csun.ecs.cs.multitouchj.ui.graphic.WindowManager.java

License:Apache License

protected void initializeOpenGl() {
    DisplayMode displayMode = displayManager.getCurrentDisplayMode();

    GL11.glEnable(GL11.GL_DEPTH_TEST);//from   w w w .  ja  va 2s.  c  om
    GL11.glClearDepth(1.0f);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glViewport(0, 0, displayMode.getWidth(), displayMode.getHeight());
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    //GLU.gluPerspective(45.0f, (float)SCREEN_WIDTH/(float)SCREEN_HEIGHT, 4.0f, 4000.0f);
    GLU.gluPerspective(45.0f, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 1.0f, 100.0f);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    //GL11.glClearDepth(1.0f);

    //GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    //GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);
}

From source file:edu.csun.ecs.cs.multitouchj.ui.utility.OpenGlUtility.java

License:Apache License

public static void orthoMode(Size size) {
    GL11.glDisable(GL11.GL_DEPTH_TEST);//w w w  . j  a  va  2 s .c o m
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glOrtho(0, size.getWidth(), 0, size.getHeight(), -10, 10);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
}

From source file:edu.csun.ecs.cs.multitouchj.ui.utility.OpenGlUtility.java

License:Apache License

public static void perspectiveMode() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();//from   w ww.ja  va2  s . c  o  m
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:eplus.renders.TableEntityItemRenderer.java

License:LGPL

/**
 * Renders a dropped item//www.  j ava  2s .  co m
 */
private void renderDroppedItem(EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5,
        float par6, float par7) {
    Tessellator tessellator = Tessellator.instance;

    if (par2Icon == null) {
        par2Icon = this.renderManager.renderEngine
                .getMissingIcon(par1EntityItem.getEntityItem().getItemSpriteNumber());
    }

    float f4 = par2Icon.getMinU();
    float f5 = par2Icon.getMaxU();
    float f6 = par2Icon.getMinV();
    float f7 = par2Icon.getMaxV();
    float f8 = 1.0F;
    float f9 = 0.5F;
    float f10 = 0.25F;
    float f11;

    GL11.glPushMatrix();

    if (renderInFrame) {
        GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
    } else {
        GL11.glRotatef((((float) par1EntityItem.age + par4) / 20.0F + par1EntityItem.hoverStart)
                * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
    }

    float f12 = 0.0625F;
    f11 = 0.021875F;
    ItemStack itemstack = par1EntityItem.getEntityItem();
    int j = itemstack.stackSize;
    byte b0 = getMiniItemCount(itemstack);

    GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));

    for (int k = 0; k < b0; ++k) {
        GL11.glTranslatef(0.0F, 0.0F, f12 + f11);
        // Makes items offset when in 3D, like when in 2D, looks much
        // better. Considered a vanilla bug...
        if (k > 0 && shouldSpreadItems()) {
            float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
            float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
            float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
            GL11.glTranslatef(x, y, f12 + f11);
        } else {
            GL11.glTranslatef(0f, 0f, f12 + f11);
        }

        if (itemstack.getItemSpriteNumber() == 0) {
            this.loadTexture("/terrain.png");
        } else {
            this.loadTexture("/gui/items.png");
        }

        GL11.glColor4f(par5, par6, par7, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, par2Icon.getSheetWidth(),
                par2Icon.getSheetHeight(), f12);

        if (itemstack != null && itemstack.hasEffect()) {
            GL11.glDepthFunc(GL11.GL_EQUAL);
            GL11.glDisable(GL11.GL_LIGHTING);
            this.renderManager.renderEngine.bindTexture("%blur%/misc/glint.png");
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
            float f13 = 0.76F;
            GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glPushMatrix();
            float f14 = 0.125F;
            GL11.glScalef(f14, f14, f14);
            float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
            GL11.glTranslatef(f15, 0.0F, 0.0F);
            GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
            ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            GL11.glScalef(f14, f14, f14);
            f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
            GL11.glTranslatef(-f15, 0.0F, 0.0F);
            GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
            ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
            GL11.glPopMatrix();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDepthFunc(GL11.GL_LEQUAL);
        }
    }

    GL11.glPopMatrix();

}

From source file:espresso3d.engine.window.viewport.E3DViewport.java

License:Open Source License

/**
 * This will automatically be called by the engine.  Users needn't worry about this.
 * Sets the perspective to the values stored in this viewport.  This keeps track of whether
 * the values have changed or not, so it will keep the GL calls to a minimum (only set the perspective
 * if something has actually changed)./*from   w w w. j av  a 2  s  . com*/
 *
 */
private void setPerspective() {
    if (perspectiveChanged) {
        GL11.glMatrixMode(GL11.GL_PROJECTION); // Select The Projection Matrix
        GL11.glLoadIdentity(); // Reset The Projection Matrix

        if (mode == VIEWPORT_MODE_PERSPECTIVE) {
            // Calculate The Aspect Ratio Of The Window
            GLU.gluPerspective((float) fovY, (float) ((float) width / (float) height), (float) nearClipPlane,
                    (float) farClipPlane);
        } else if (mode == VIEWPORT_MODE_ORTHOGRAPHIC)
            GL11.glOrtho(left * orthoZoom, right * orthoZoom, bottom * orthoZoom, top * orthoZoom,
                    nearClipPlane, farClipPlane); //todo: this needs to center around the camera.  Need to determin whether to use X/Y, Y/Z, or X/Z to center on

        recalcProjectionViewMatrix();

        perspectiveChanged = false;
    }

    GL11.glMatrixMode(GL11.GL_MODELVIEW); // Select The Projection Matrix
    GL11.glLoadIdentity(); // Reset The Modelview Matrix

    GL11.glDepthMask(true); //Re-enable this.  IF particles turn this off, it has to be turned on to be able to clear the depth buffer
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer

    GLU.gluLookAt((float) cameraActor.getOrientation().getPosition().getX(),
            (float) cameraActor.getOrientation().getPosition().getY(),
            (float) cameraActor.getOrientation().getPosition().getZ(),
            ((float) (cameraActor.getOrientation().getPosition().getX()
                    + cameraActor.getOrientation().getForward().getX())),
            ((float) (cameraActor.getOrientation().getPosition().getY()
                    + cameraActor.getOrientation().getForward().getY())),
            ((float) (cameraActor.getOrientation().getPosition().getZ()
                    + cameraActor.getOrientation().getForward().getZ())),
            (float) cameraActor.getOrientation().getUp().getX(),
            (float) cameraActor.getOrientation().getUp().getY(),
            (float) cameraActor.getOrientation().getUp().getZ());

    //If something has changed camera wise, we need to recalculate the viewport matrix 
    // the next time something asks for a projection or unprojection
    if (!cameraActor.getOrientation().getPosition().equals(lastPosition)
            || !cameraActor.getOrientation().getForward().equals(lastForward)
            || !cameraActor.getOrientation().getUp().equals(lastUp)) {
        lastPosition.set(cameraActor.getOrientation().getPosition());
        lastForward.set(cameraActor.getOrientation().getForward());
        lastUp.set(cameraActor.getOrientation().getUp());
        needViewArrayRecalc = true;
    }
}