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:zildo.platform.filter.LwjglCloudFilter.java

License:Open Source License

@Override
public boolean renderFilter() {

    super.startInitialization();
    updateQuad(0, 0, u, v, Reverse.NOTHING);
    this.endInitialization();

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();//from   w ww.  j  a  v a  2s.c om
    GL11.glTranslatef(0, -sizeY, 1);

    float colorFactor = 0.2f;
    GL11.glColor4f(colorFactor, colorFactor, colorFactor, 0.1f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_COLOR);

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, ClientEngineZildo.tileEngine.texCloudId);
    super.render();

    GL11.glDisable(GL11.GL_BLEND);

    GL11.glPopMatrix();

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    return true;
}

From source file:zildo.platform.filter.LwjglFitToScreenFilter.java

License:Open Source License

@Override
public boolean renderFilter() {

    // Select right texture
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, ClientEngineZildo.tileEngine.texBackMenuId);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();/*from w w w . jav  a  2s  . c o m*/
    GL11.glTranslatef(0, -sizeY, 1);

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

    if (!resized) {
        startInitialization();
        updateQuad(0, 0, 1, 0.1f, Reverse.HORIZONTAL);
        endInitialization();
        startInitialization();
        updateTextureCoordinates(0, 0, textureSizeX, -textureSizeY, false);
        endInitialization();
        resized = true;
    }
    // This filter is in charge to alter all screen colors
    Vector3f v = ClientEngineZildo.ortho.getFilteredColor();
    GL11.glColor3f(v.x, v.y, v.z);

    // Draw texture with depth
    super.render();

    GL11.glDisable(GL11.GL_BLEND);

    // Reset full color
    GL11.glColor3f(1, 1, 1);

    GL11.glPopMatrix();

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    return true;
}

From source file:zildo.platform.opengl.LwjglOpenGLGestion.java

License:Open Source License

@Override
public void render(boolean p_clientReady) {

    // Clear the screen and the depth buffer
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

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

    // invert the y axis, down is positive
    float zz = z * 5.0f;
    if (zz != 0.0f) {
        GL11.glTranslatef(-zoomPosition.getX() * zz, zoomPosition.getY() * zz, 0.0f);
    }/*from   w ww  . j  av a 2 s.c o  m*/
    GL11.glScalef(1 + zz, -1 - zz, 1);
    if (ClientEngineZildo.filterCommand != null) {
        ClientEngineZildo.filterCommand.doPreFilter();
    }

    clientEngineZildo.renderFrame(awt);
    /*
    if (!p_clientReady && !awt) {
       clientEngineZildo.renderMenu();
    }
    */
    for (GameStage stage : ClientEngineZildo.getClientForGame().getCurrentStages()) {
        stage.renderGame();
    }

    if (ClientEngineZildo.filterCommand != null) {
        ClientEngineZildo.filterCommand.doFilter();
        ClientEngineZildo.filterCommand.doPostFilter();
    }

    if (framerate != 0) {
        Display.sync(framerate);
    }

    if (!awt) {
        Display.update();
    }
}

From source file:zildo.platform.opengl.LwjglOrtho.java

License:Open Source License

@Override
public void setOrthographicProjection(boolean p_zoom) {
    if (!orthoSetUp) {
        // switch to projection mode
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        // save previous matrix which contains the
        // settings for the perspective projection
        GL11.glPushMatrix();/*from  w  w w  .ja  v  a 2s .c  om*/
        // reset matrix
        GL11.glLoadIdentity();
        // set a 2D orthographic projection
        GL11.glViewport(0, 0, Zildo.screenX, Zildo.screenY);
        if (p_zoom) {
            GL11.glOrtho(0, w / 2, 0, h / 2, -99999, 99999);
            GL11.glTranslatef(0, -h / 2, 0);
        } else {
            GL11.glOrtho(0, w, 0, h, -99999, 99999);
        }
        // invert the y axis, down is positive
        // GL11.glScalef(1, -1, 1);
        // GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        // mover the origin from the bottom left corner
        // to the upper left corner
        GL11.glTranslatef(0, h, 0);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        orthoSetUp = true;
    }
}

From source file:zsawyer.mods.stereoscopic3d.MinecraftCopy.java

License:Open Source License

/**
 * Displays a new screen./*w  w  w  . ja  v  a 2  s  . co  m*/
 */
public static void loadScreen() throws LWJGLException {
    ScaledResolution var1 = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
    GL11.glClear(16640);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0.0D, var1.getScaledWidth_double(), var1.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
    GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
    GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_FOG);
    Tessellator var2 = Tessellator.instance;
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture("/title/mojang.png"));
    var2.startDrawingQuads();
    var2.setColorOpaque_I(16777215);
    var2.addVertexWithUV(0.0D, (double) mc.displayHeight, 0.0D, 0.0D, 0.0D);
    var2.addVertexWithUV((double) mc.displayWidth, (double) mc.displayHeight, 0.0D, 0.0D, 0.0D);
    var2.addVertexWithUV((double) mc.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D);
    var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
    var2.draw();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    var2.setColorOpaque_I(16777215);
    short var3 = 256;
    short var4 = 256;
    mc.scaledTessellator((var1.getScaledWidth() - var3) / 2, (var1.getScaledHeight() - var4) / 2, 0, 0, var3,
            var4);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    Display.swapBuffers();
}

From source file:zsawyer.mods.stereoscopic3d.renderers.StereoscopicRenderer.java

License:Open Source License

public void setupView(int x, int y, int width, int height, boolean eager) {
    GL11.glViewport(x, y, width, height);

    if (eager) {/*from   w w  w.j  av  a  2 s . c o  m*/
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glLoadIdentity();
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
        GLU.gluOrtho2D(0, width, 0, height);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glLoadIdentity();
    }
}