Example usage for org.lwjgl.opengl GL11 glLoadIdentity

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

Introduction

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

Prototype

public static native void glLoadIdentity();

Source Link

Document

Sets the current matrix to the identity matrix.

Usage

From source file:matteroverdrive.client.render.entity.EntityRendererRougeAndroid.java

License:Open Source License

@Override
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_,
        float p_76986_8_, float p_76986_9_) {
    if (hologram) {
        GL11.glPushMatrix();//from  w  ww.ja  v a 2s.  c om
        GL11.glDisable(GL11.GL_CULL_FACE);
        this.mainModel.onGround = this.renderSwingProgress(p_76986_1_, p_76986_9_);

        if (this.renderPassModel != null) {
            this.renderPassModel.onGround = this.mainModel.onGround;
        }

        this.mainModel.isRiding = p_76986_1_.isRiding();

        if (this.renderPassModel != null) {
            this.renderPassModel.isRiding = this.mainModel.isRiding;
        }

        this.mainModel.isChild = p_76986_1_.isChild();

        if (this.renderPassModel != null) {
            this.renderPassModel.isChild = this.mainModel.isChild;
        }

        this.renderLivingAt(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_);

        try {
            float f2 = 0;
            float f3 = 0;
            float f4;

            f4 = this.handleRotationFloat(p_76986_1_, p_76986_9_);
            this.rotateCorpse(p_76986_1_, f4, f2, p_76986_9_);
            float f5 = 0.0625F;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            GL11.glScalef(-1.0F, -1.0F, 1.0F);
            this.preRenderCallback(p_76986_1_, p_76986_9_);
            GL11.glTranslatef(0.0F, -24.0F * f5 - 0.0078125F, 0.0F);
            float f6 = p_76986_1_.prevLimbSwingAmount
                    + (p_76986_1_.limbSwingAmount - p_76986_1_.prevLimbSwingAmount) * p_76986_9_;
            float f7 = p_76986_1_.limbSwing - p_76986_1_.limbSwingAmount * (1.0F - p_76986_9_);

            if (p_76986_1_.isChild()) {
                f7 *= 3.0F;
            }

            if (f6 > 1.0F) {
                f6 = 1.0F;
            }

            GL11.glEnable(GL11.GL_ALPHA_TEST);
            this.mainModel.setLivingAnimations(p_76986_1_, f7, f6, p_76986_9_);
            this.renderModel(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);
            int j;
            float f8;
            float f9;
            float f10;

            for (int i = 0; i < 4; ++i) {
                j = this.shouldRenderPass(p_76986_1_, i, p_76986_9_);

                if (j > 0) {
                    this.renderPassModel.setLivingAnimations(p_76986_1_, f7, f6, p_76986_9_);
                    this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);

                    if ((j & 240) == 16) {
                        this.func_82408_c(p_76986_1_, i, p_76986_9_);
                        this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch,
                                f5);
                    }

                    if ((j & 15) == 15) {
                        f8 = (float) p_76986_1_.ticksExisted + p_76986_9_;
                        //this.bindTexture(RES_ITEM_GLINT);
                        GL11.glEnable(GL11.GL_BLEND);
                        f9 = 0.5F;
                        GL11.glColor4f(f9, f9, f9, 1.0F);
                        GL11.glDepthFunc(GL11.GL_EQUAL);
                        GL11.glDepthMask(false);

                        for (int k = 0; k < 2; ++k) {
                            GL11.glDisable(GL11.GL_LIGHTING);
                            f10 = 0.76F;
                            GL11.glColor4f(0.5F * f10, 0.25F * f10, 0.8F * f10, 1.0F);
                            GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
                            GL11.glMatrixMode(GL11.GL_TEXTURE);
                            GL11.glLoadIdentity();
                            float f11 = f8 * (0.001F + (float) k * 0.003F) * 20.0F;
                            float f12 = 0.33333334F;
                            GL11.glScalef(f12, f12, f12);
                            GL11.glRotatef(30.0F - (float) k * 60.0F, 0.0F, 0.0F, 1.0F);
                            GL11.glTranslatef(0.0F, f11, 0.0F);
                            GL11.glMatrixMode(GL11.GL_MODELVIEW);
                            this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2,
                                    p_76986_1_.rotationPitch, f5);
                        }

                        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                        GL11.glMatrixMode(GL11.GL_TEXTURE);
                        GL11.glDepthMask(true);
                        GL11.glLoadIdentity();
                        GL11.glMatrixMode(GL11.GL_MODELVIEW);
                        GL11.glEnable(GL11.GL_LIGHTING);
                        GL11.glDisable(GL11.GL_BLEND);
                        GL11.glDepthFunc(GL11.GL_LEQUAL);
                    }

                    GL11.glDisable(GL11.GL_BLEND);
                    GL11.glEnable(GL11.GL_ALPHA_TEST);
                }
            }

            GL11.glDepthMask(true);
            this.renderEquippedItems(p_76986_1_, p_76986_9_);
            float f14 = p_76986_1_.getBrightness(p_76986_9_);
            j = this.getColorMultiplier(p_76986_1_, f14, p_76986_9_);
            OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);

            if ((j >> 24 & 255) > 0 || p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) {
                GL11.glDisable(GL11.GL_TEXTURE_2D);
                GL11.glDisable(GL11.GL_ALPHA_TEST);
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                GL11.glDepthFunc(GL11.GL_EQUAL);

                if (p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) {
                    GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
                    this.mainModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);

                    for (int l = 0; l < 4; ++l) {
                        if (this.inheritRenderPass(p_76986_1_, l, p_76986_9_) >= 0) {
                            GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
                            this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2,
                                    p_76986_1_.rotationPitch, f5);
                        }
                    }
                }

                if ((j >> 24 & 255) > 0) {
                    f8 = (float) (j >> 16 & 255) / 255.0F;
                    f9 = (float) (j >> 8 & 255) / 255.0F;
                    float f15 = (float) (j & 255) / 255.0F;
                    f10 = (float) (j >> 24 & 255) / 255.0F;
                    GL11.glColor4f(f8, f9, f15, f10);
                    this.mainModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5);

                    for (int i1 = 0; i1 < 4; ++i1) {
                        if (this.inheritRenderPass(p_76986_1_, i1, p_76986_9_) >= 0) {
                            GL11.glColor4f(f8, f9, f15, f10);
                            this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2,
                                    p_76986_1_.rotationPitch, f5);
                        }
                    }
                }

                GL11.glDepthFunc(GL11.GL_LEQUAL);
                GL11.glDisable(GL11.GL_BLEND);
                GL11.glEnable(GL11.GL_ALPHA_TEST);
                GL11.glEnable(GL11.GL_TEXTURE_2D);
            }

            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        } catch (Exception exception) {

        }

        OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glPopMatrix();
        this.passSpecialRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_);
    } else {
        super.doRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
    }
}

From source file:matteroverdrive.gui.GuiStarMap.java

License:Open Source License

public void drawWorldBackground(int p_146270_1_) {
    glDisable(GL_TEXTURE_2D);/*from   ww  w  .j av  a2s. c om*/
    glColor3f(0, 0, 0);
    RenderUtils.drawPlane(0, 0, -1000, width, height);
    glEnable(GL_TEXTURE_2D);
    glPushMatrix();

    //GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
    //GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
    glPushAttrib(GL_COLOR_BUFFER_BIT);
    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    glPushMatrix();
    GL11.glLoadIdentity();
    Project.gluPerspective(75f, (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05f, 20);
    //RenderUtil.loadMatrix(camera.getTransposeProjectionMatrix());
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    glPushMatrix();
    GL11.glLoadIdentity();
    //RenderUtil.loadMatrix(camera.getTransposeViewMatrix());
    glRotated(15, 1, 0, 0);
    GL11.glTranslatef(0, -0.8f, 0);

    float lastRotationYaw = Minecraft.getMinecraft().renderViewEntity.rotationYaw;
    float lastRotationPitch = Minecraft.getMinecraft().renderViewEntity.rotationPitch;
    float rotation = 0;
    if (machine.getZoomLevel() <= 2) {
        rotation = mc.theWorld.getWorldTime() * 0.1f;
    }
    Minecraft.getMinecraft().renderViewEntity.rotationYaw = 180 + rotation;
    Minecraft.getMinecraft().renderViewEntity.prevRotationPitch = Minecraft
            .getMinecraft().renderViewEntity.rotationPitch = 15;

    //bindTexture(ClientProxy.renderHandler.getRendererOmniTool().getWeaponTexture());
    //ClientProxy.renderHandler.getRendererOmniTool().getModel().renderAll();
    switch (machine.getZoomLevel()) {
    case 0:
        glTranslated(0, -1.1, -4f);
        break;
    case 1:
        glTranslated(0, -0.6, -4f);
        break;
    case 2:
        Star star = machine.getStar();
        float maxDistance = 0;
        if (star != null) {
            for (Planet planet : star.getPlanets()) {
                if (maxDistance < planet.getOrbit()) {
                    maxDistance = planet.getOrbit();
                }
            }
        }
        glTranslated(0, 0, -maxDistance * 3 - 1.5f);
        break;
    default:
        GL11.glTranslatef(0, 0.1f, -3f);
        break;
    }

    glRotated(rotation, 0, 1, 0);
    //glTranslated(0.5f,2.5f,3);
    ClientProxy.renderHandler.getTileEntityRendererStarMap().render(machine, -0.5f, -1.8f, -0.5f, 0);
    glPopMatrix();
    //fontRendererObj.drawString("Test",100,100,0xffffff);

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

    Minecraft.getMinecraft().renderViewEntity.rotationYaw = lastRotationYaw;
    Minecraft.getMinecraft().renderViewEntity.prevRotationPitch = Minecraft
            .getMinecraft().renderViewEntity.rotationPitch = lastRotationPitch;

    GL11.glPopAttrib();
}

From source file:mcp.mobius.waila.gui.truetyper.FontHelper.java

License:Open Source License

private static void set2DMode(FloatBuffer matrixData) {
    Minecraft mc = Minecraft.getMinecraft();
    ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    mc.entityRenderer.setupOverlayRendering();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();/*from   w  ww.jav  a2s. c  om*/
    //GL11.glLoadMatrix(matrixData);

    GL11.glLoadIdentity();
    GL11.glOrtho(0, mc.displayWidth, 0, mc.displayHeight, -1, 1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();

    Matrix4f matrix = new Matrix4f();
    matrix.load(matrixData);
    GL11.glTranslatef(matrix.m30 * sr.getScaleFactor(), -matrix.m31 * sr.getScaleFactor(), 0f);

}

From source file:modeledit.ModelView3D.java

License:Open Source License

private void glInit() {
    try {//from  w w  w. j a v a 2s .c  o  m
        this.makeCurrent();
    } catch (Exception e) {
        return;
        //           e.printStackTrace();
    }
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GLU.gluPerspective(40, ((float) this.getWidth()) / ((float) this.getHeight()), 1, 100);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glShadeModel(GL11.GL_SMOOTH);
    //      GL11.glPolygonMode(GL11.GL_FRONT,GL11.GL_LINE); 
    //      GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping

    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, get(whiteLight));
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, get(whiteLight));

    GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, get(ambientLight));

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_LIGHT0);

    GLUtils.glLightPos(1.0f, 1.0f, 1.0f);

    //       GL11.glTexParameteri(GL11.GL_TEXTURE_2D,GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
    //       GL11.glTexParameteri(GL11.GL_TEXTURE_2D,GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);

}

From source file:modeledit.ModelView3D.java

License:Open Source License

public void draw() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    GL11.glMatrixMode(GL11.GL_VIEWPORT);
    GL11.glViewport(0, 0, getWidth(), getHeight());

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();//from  w  ww  . j  a v a 2 s. com
    GLU.gluPerspective(40, ((float) this.getWidth()) / ((float) this.getHeight()), 1, 100);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glTranslatef(panX, panY, 0);

    //(float)(camDist*Math.sin(camTheta)*Math.cos(camPhi))
    GLU.gluLookAt((float) (camDist * Math.sin(camTheta) * Math.sin(camPhi)),
            (float) (camDist * Math.cos(camTheta) * Math.sin(camPhi)), (float) (camDist * Math.cos(camPhi)), 0,
            0, 0, 0, 0, 1);
    if (model != null) {
        model.draw(state);
    }
}

From source file:mwisbest.openbase.Common.java

License:Open Source License

/**
 * Common code for rendering the Widgets to the screen. After this, customRender() is used from OpenBASE or OpenBASEApplet (whatever is calling this method).
 *//*  ww w. ja va 2  s . c  om*/
protected static void render(int framerateLimit) {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    Map<String, Widget> theWidgets = ResourceManager.getWidgets();
    for (RenderPriority priority : RenderPriority.values()) {
        for (Entry<String, Widget> widget : theWidgets.entrySet()) {
            if (widget.getValue().getRenderPriority() == priority && widget.getValue().getVisible())
                widget.getValue().render();
        }
    }
    if (framerateLimit > 0)
        Display.sync(framerateLimit);
}

From source file:myfirstgame.Window.java

public void init(int width, int height) {

    Window.width = width;/*  w  w w .j  a  v a2 s . c o m*/
    Window.height = height;

    try { //Look for a displaymode with matching width and height that supports fullscreen, set it to the displaymode we want to use.
        DisplayMode displayMode = null;
        DisplayMode[] modes = Display.getAvailableDisplayModes();

        for (int i = 0; i < modes.length; i++) {
            if (modes[i].getWidth() == width && modes[i].getHeight() == height
                    && modes[i].isFullscreenCapable()) {
                displayMode = modes[i];
            }
        }
        Display.setDisplayMode(displayMode);
        Display.setFullscreen(true);
        Display.create();

    } catch (Exception e) {
        e.printStackTrace();
        System.exit(0);
    }

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, 800, 0, 600, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);

    try {
        Mouse.create();
        Keyboard.create();
    } catch (LWJGLException ex) {
        Logger.getLogger(Window.class.getName()).log(Level.SEVERE, null, ex);
    }
    //Mouse.setGrabbed(true);
}

From source file:name.martingeisse.minimal.simulation.lwjgl.LwjglWindow.java

License:Open Source License

/**
 * Constructor./*w ww. java  2 s.co  m*/
 * @param width the window width
 * @param height the window height
 */
public LwjglWindow(int width, int height) {
    try {
        LwjglNativeLibraryHelper.prepareNativeLibraries();
        Display.setDisplayMode(new DisplayMode(width, height));
        Display.setTitle("Minimal");
        Display.setFullscreen(true);
        Display.create(new PixelFormat(0, 24, 0));
        Keyboard.create();
    } catch (Exception e) {
        throw new RuntimeException("could not open LWJGL window", e);
    }
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, width, height, 0, -1, 1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
}

From source file:name.martingeisse.stackd.client.gui.Gui.java

License:Open Source License

/**
 * Fires the specified event./* ww  w  . j  a va  2s. c o  m*/
 * @param event the event
 */
public void fireEvent(GuiEvent event) {
    if (rootElement == null) {
        return;
    }
    if (event == GuiEvent.DRAW) {
        if (layoutRequested) {
            rootElement.requestSize(widthUnits, HEIGHT_UNITS);
            rootElement.setPosition(0, 0);
            layoutRequested = false;
        }
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glLoadIdentity();
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
        GL11.glOrtho(0, widthUnits, HEIGHT_UNITS, 0, -1, 1);
    }
    time = (int) System.currentTimeMillis();
    rootElement.handleEvent(event);
}

From source file:name.martingeisse.swtlib.canvas.AbstractOpenGlBlockCanvas.java

License:Open Source License

/**
 * //from   w  w  w.  j  a v a  2  s  . c o  m
 */
private void setupOpenGl() {
    prepareOpenGl();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    matrixBuffer.rewind();
    GL11.glLoadMatrix(matrixBuffer);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
}