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:org.terasology.rendering.dag.nodes.FirstPersonViewNode.java

License:Apache License

@Override
public void process() {
    PerformanceMonitor.startActivity("rendering/firstPersonView");

    READ_ONLY_GBUFFER.bind(); // TODO: to be removed - will eventually be bound with a state change

    GL11.glPushMatrix();//  w  w w. j a  v a  2s .co m
    GL11.glLoadIdentity();
    //GL11.glDepthFunc(GL11.GL_ALWAYS); // TODO: remove commented out lines when we know what to do with this node

    playerCamera.updateMatrices(90f);
    playerCamera.loadProjectionMatrix();

    for (RenderSystem renderer : componentSystemManager.iterateRenderSubscribers()) {
        renderer.renderFirstPerson();
    }

    playerCamera.updateMatrices();
    playerCamera.loadProjectionMatrix();

    //GL11.glDepthFunc(GL_LEQUAL);
    GL11.glPopMatrix();

    PerformanceMonitor.endActivity();
}

From source file:org.terasology.rendering.opengl.GraphicState.java

License:Apache License

/**
 * Sets the state to render the First Person View.
 *
 * This generally comprises the objects held in hand, i.e. a pick, an axe, a torch and so on.
 *///  www  . j  a  va  2  s .  c  om
public void preRenderSetupFirstPerson() {
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glDepthFunc(GL11.GL_ALWAYS);
}

From source file:rainet.Game.java

private void initGL(int width, int height, String title) {
    try {/*from   w  ww  . j  av a 2 s.  c  o m*/
        Display.setDisplayMode(new DisplayMode(width, height));
        Display.setLocation(6, 7);
        Display.setTitle(title);
        Display.create();
        Display.setVSyncEnabled(true);
    } catch (LWJGLException e) {
        e.printStackTrace();
        System.exit(0);
    }
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glViewport(0, 0, width, height);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, width, height, 0, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
}

From source file:rainwarrior.mt100.client.PstFont.java

License:Open Source License

public void bindFontTexture() {
    GL11.glLoadIdentity();
    GL11.glScalef(1F / textureWidth, 1F / textureHeight, 1F);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.get(0));
    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);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
}

From source file:render.Render.java

License:Open Source License

public void resetGL() {
    try {/*from   ww w . ja v  a  2s.  co m*/
        Display.setDisplayMode(
                new DisplayMode(Display.getParent().getWidth(), Display.getParent().getHeight()));
    } catch (LWJGLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(-Display.getWidth() / 2, Display.getWidth() / 2, -Display.getHeight() / 2,
            Display.getHeight() / 2, -1.0, 1.0);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

}

From source file:rtype.entity.Missile.java

License:Open Source License

public void draw() {

    animationCursor += animationSpeed * tick;
    animationCursor %= animationTextures.length;

    GL11.glLoadIdentity();
    GL11.glTranslatef(position.x, position.y, Prototyp.DEFAULT_Z); // Translate Into/Out Of The Screen By z

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.animationTextures[(int) animationCursor].getTextureId());
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glBegin(GL11.GL_QUADS);/*from   w  w w. j  a  v  a 2  s . co m*/
    {
        GL11.glTexCoord2f(textureRight, textureUp); //Upper right
        GL11.glVertex2f(width, -height);

        GL11.glTexCoord2f(textureLeft, textureUp); //Upper left         
        GL11.glVertex2f(-width, -height);

        GL11.glTexCoord2f(textureLeft, textureDown); //Lower left
        GL11.glVertex2f(-width, height);

        GL11.glTexCoord2f(textureRight, textureDown); // Lower right
        GL11.glVertex2f(width, height);

    }
    GL11.glEnd();

}

From source file:rtype.Prototyp.java

License:Open Source License

private void initGL() {

    GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping

    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
    GL11.glClearDepth(1.0f); // Depth Buffer Setup
    GL11.glDisable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
    GL11.glEnable(GL11.GL_BLEND);//w ww .j  ava2  s.  com
    GL11.glDepthMask(false);
    GL11.glMatrixMode(GL11.GL_PROJECTION); // Select The Projection Matrix
    GL11.glLoadIdentity(); // Reset The Projection Matrix

    GLU.gluOrtho2D(-(int) SCREEN_WIDTH / 2, (int) SCREEN_WIDTH / 2, (int) -SCREEN_HEIGHT / 2,
            (int) SCREEN_HEIGHT / 2);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    if (useDevil)
        ;//textureLoader = new DevilTextureLoader();
    else {
        textureLoader = new WorkAroundTextureLoader();
    }
    textureLoader.init();
}

From source file:rtype.Prototyp.java

License:Open Source License

private void saveScreen() {
    GL11.glLoadIdentity();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, SCREEN_TEXTURE_ID);
    GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, (int) SCREEN_WIDTH, (int) SCREEN_HEIGHT);

}

From source file:rtype.Prototyp.java

License:Open Source License

public void fadeScreen(boolean draw_fb) // draw_fb is a quick and dirty fix, fb should be in a specificl layer "postFadeEffect" or something
{

    if (fadeAlpha > 0.1) {

        GL11.glLoadIdentity();
        GL11.glTranslatef(0, 0, Prototyp.DEFAULT_Z);
        GL11.glColor4f(0, 0, 0, fadeAlpha / 1.2f);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        //GL11.glColor4f(0.5f,0.5f,0.5f,0.5f);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glBegin(GL11.GL_QUADS);/*from   w  w  w  .ja va2  s.c  om*/
        {
            GL11.glVertex2f(Prototyp.SCREEN_WIDTH / 2, -Prototyp.SCREEN_HEIGHT / 2);
            GL11.glVertex2f(-Prototyp.SCREEN_WIDTH / 2, -Prototyp.SCREEN_HEIGHT / 2);
            GL11.glVertex2f(-Prototyp.SCREEN_WIDTH / 2, Prototyp.SCREEN_HEIGHT / 2);
            GL11.glVertex2f(Prototyp.SCREEN_WIDTH / 2, Prototyp.SCREEN_HEIGHT / 2);
        }
        GL11.glEnd();
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    }

    if (player1 != null && player1.orb != null && player1.orb.fb != null && player1.orb.fb.displayAnimation
            && draw_fb) {
        player1.orb.fb.updateTick();
        player1.orb.fb.draw(fadeAlpha * 2);
    }
}

From source file:rtype.Prototyp.java

License:Open Source License

private void drawPowerBar() {
    GL11.glLoadIdentity();
    GL11.glTranslatef(0, 0, Prototyp.DEFAULT_Z);
    GL11.glColor4f(0, 0, 1, 1f);/*from   w  w w  . j  a  v  a2 s .co m*/
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(0, -0);
    GL11.glVertex2f(0, -0 - 100);
    GL11.glVertex2f(0 + player1.power * 10 / 4, 0);
    GL11.glVertex2f(0 + player1.power * 10 / 4, 0 - 100);
    GL11.glEnd();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glColor4f(1, 1, 1, 1f);
}