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:gravestone.models.block.memorials.ModelCreeperStatueMemorial.java

License:LGPL

private void renderCreeperCharging() {
    float tickModifier = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 48.0F;
    float scale = 1.2F;
    float f4 = 0.5F;

    GL11.glTranslated(0, -0.5, 0);/*from  w  w w.j  av a  2  s  . c o m*/
    GL11.glScalef(scale, scale, scale);
    TileEntityGSMemorialRenderer.instance.bindTextureByName(Resources.CREEPER_AURA);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
    GL11.glMatrixMode(GL11.GL_TEXTURE);

    for (int var21 = 0; var21 < 3; ++var21) {
        GL11.glLoadIdentity();
        float var23 = tickModifier * (0.001F + (float) var21 * 0.0015F) * 15;
        GL11.glTranslatef(0, var23, 0);
        renderCreeper();
    }

    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glLoadIdentity();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);

    GL11.glTranslated(0, -0.19, 0);
}

From source file:gravestone.models.block.ModelGraveStone.java

License:LGPL

protected void renderEnchantment() {
    float tickModifier = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 48.0F;
    TileEntityGSGraveStoneRenderer.instance.bindTextureByName(Resources.SWORD_AURA);

    GL11.glEnable(GL11.GL_BLEND);//ww w .  j ava 2 s  . c om
    GL11.glDepthMask(true);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
    GL11.glMatrixMode(GL11.GL_TEXTURE);

    for (int var21 = 0; var21 < 3; var21++) {
        GL11.glDisable(GL11.GL_LIGHTING);
        float var22 = 0.76F;
        GL11.glColor4f(0.5F * var22, 0.25F * var22, 0.8F * var22, 1.0F);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glLoadIdentity();
        float var23 = tickModifier * (0.001F + (float) var21 * 0.0015F) * 15;
        float var24 = 0.33333334F;
        GL11.glScalef(var24, var24, var24);
        GL11.glRotatef(30 - (float) var21 * 60, 0, 0, 1);
        GL11.glTranslatef(0, var23, 0);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        renderAll();
    }

    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);
}

From source file:herzog3d.Camera.java

License:Open Source License

public void transform() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GLU.gluPerspective(40, 1, 1, 100);//from   www . j  a v  a2 s  . c  o m
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    Vector3f targetPos = new Vector3f(mech.getPos());
    GLU.gluLookAt(pos.x, pos.y, pos.z, targetPos.x, targetPos.y, targetPos.z, 0, 0, 1);
}

From source file:herzog3d.Game.java

License:Open Source License

/**
 * All rendering is done in here// ww  w  . j av  a2 s  . c om
 */
public void draw() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    cam.transform();
    GLUtils.glLightPos(1.0f, 1.0f, 1.0f);
    GL11.glColor3f(1.0f, 1.0f, 1.0f);
    getMap().draw(cam);

    for (Unit unit : units) {
        if (unit.isActive()) {
            unit.draw();
        }
    }

    for (Base base : bases) {
        base.draw(map);
    }
    for (Effect effect : effects) {
        effect.draw();
    }

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, 800, 600, 0, 0, 1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);
    Material.DEFAULT_WHITE.bind();
    for (HZWidget overlay : overlays) {
        if (overlay.isVisible()) {
            overlay.draw();
        }
    }
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_DEPTH_TEST);

}

From source file:hexagonalminesweeper.HexagonalMinesweeper.java

public static void renderGL() {
    try {/*ww  w.  j a  va  2  s.c o  m*/
        Display.setDisplayMode(new org.lwjgl.opengl.DisplayMode(800, 600));
        Display.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
        System.exit(0);
    }

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glClearDepth(1);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glViewport(0, 0, 800, 600);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, 800, 600, 0, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    Display.setVSyncEnabled(true);
}

From source file:hud.UnitDisplay.java

License:Open Source License

public void draw() {
    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE);
    GL11.glColor4f(0.0f, 0.0f, 0.4f, 1.0f);
    GL11.glLineWidth(2.0f);//from   w ww.  j av  a2  s .  co m
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x, y + height);
    GL11.glVertex2i(x + width, y + height);
    GL11.glVertex2i(x + width, y);
    GL11.glEnd();

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);
    GL11.glColor4f(0.0f, 0.5f, 1.0f, 0.8f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2i(x, y);
    GL11.glVertex2i(x, y + height);
    GL11.glVertex2i(x + width, y + height);
    GL11.glVertex2i(x + width, y);
    GL11.glEnd();
    GL11.glDisable(GL11.GL_BLEND);

    int[] viewport = GLUtils.getViewport();

    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GLU.gluPerspective(45, 1.0f, 0.001f, 5.0f);
    GL11.glViewport(getX(), viewport[3] - (getY() + height), width, height);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GLU.gluLookAt(2.0f * (float) Math.cos(angle), 2.0f * (float) Math.sin(angle), 1.0f, 0, 0, 0, 0, 0, 1);
    //        GL11.glTranslatef(x + width/2, y + height/2,0);
    currentUnit.draw();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);
}

From source file:illarion.graphics.lwjgl.RenderDisplayLWJGL.java

License:Open Source License

/**
 * Update the display so the last drawn picture gets visible.
 *//*ww w  .j a  v  a  2s. c o m*/
public void update() {
    AbstractTextureRender.finish();

    Display.update();

    // clean display for next render loop.
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);
    GL11.glLoadIdentity();
}

From source file:illarion.graphics.lwjgl.RenderDisplayLWJGL.java

License:Open Source License

/**
 * Setup the openGL render environment. Such as the view port the matrix for
 * the orthogonal view and so on./*from   w  w  w .  j  a va2  s. c o m*/
 */
protected void setupOpenGL() {
    if (!Display.isCreated()) {
        return;
    }

    // set the basic view port of the game. This should be the full size of
    // the client window
    GL11.glViewport(0, 0, resWidth, resHeight);

    // enable alpha blending based on the picture alpha channel
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    // disable death test, we work in 2D anyway, there is no depth
    GL11.glDisable(GL11.GL_DEPTH_TEST);

    // switch to projection matrix to set up the orthogonal view that we
    // need
    GL11.glMatrixMode(GL11.GL_PROJECTION);

    // load the identity matrix to we have a clean start
    GL11.glLoadIdentity();

    // setup the orthogonal view
    GLU.gluOrtho2D(0, resWidth, 0, resHeight);

    // set clear color to black
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    // sync frame (only works on windows)
    if (Graphics.NO_SLOWDOWN) {
        Display.setVSyncEnabled(false);
    } else {
        Display.setVSyncEnabled(true);
    }

    // clean up the screen
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    // switch to model view matrix, so we can place the sprites correctly
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
}

From source file:im.bci.jnuit.lwjgl.LwjglNuitRenderer.java

License:Open Source License

@Override
public void render(Root root) {
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_TRANSFORM_BIT | GL11.GL_HINT_BIT | GL11.GL_COLOR_BUFFER_BIT
            | GL11.GL_SCISSOR_BIT | GL11.GL_LINE_BIT | GL11.GL_TEXTURE_BIT);
    GL11.glViewport(0, 0, LwjglHelper.getWidth(), LwjglHelper.getHeight());
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();/*from w  w w.j ava 2  s.c  om*/
    GL11.glLoadIdentity();
    GL11.glOrtho(root.getX(), root.getWidth(), root.getHeight(), root.getY(), -1.0, 1.0);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_SCISSOR_TEST);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    drawBackgroundAndBorder(root);
    drawStack(root);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:io.flob.blackheart.DisplayDriver.java

License:Open Source License

private void init_GL() {
    GL11.glClearColor(0.1F, 0.1F, 0.1F, 1.0F);
    GL11.glEnable(GL11.GL_BLEND);/*from  w  w w. ja v a  2s.c om*/
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GLU.gluPerspective(60.0f, ((float) Display.getWidth()) / ((float) Display.getHeight()), 0.1f, 40.0f);
}