Example usage for org.lwjgl.opengl GL11 glTexCoord2f

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

Introduction

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

Prototype

public static native void glTexCoord2f(@NativeType("GLfloat") float s, @NativeType("GLfloat") float t);

Source Link

Document

Sets the current two-dimensional texture coordinate.

Usage

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

License:Open Source License

private void render_left() {
    if (texture_left == null) {
        texture_left = TextureLibrary.placeholder;
    }//  www  .j  av  a 2s .com
    GL11.glNormal3f(-1, 0, 0);
    GL11.glTexCoord2f(texture_left.getU(), texture_left.getV2());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(texture_left.getU2(), texture_left.getV2());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(texture_left.getU2(), texture_left.getV());
    GL11.glVertex3f(-size + position.getX(), size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(texture_left.getU(), texture_left.getV());
    GL11.glVertex3f(-size + position.getX(), size + position.getY(), -size + position.getZ());
}

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

License:Open Source License

private void render_right() {
    if (texture_right == null) {
        texture_right = TextureLibrary.placeholder;
    }// w w  w .  jav a  2s .c o m
    GL11.glNormal3f(1, 0, 0);
    GL11.glTexCoord2f(texture_right.getU2(), texture_right.getV2());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(texture_right.getU2(), texture_right.getV());
    GL11.glVertex3f(size + position.getX(), size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(texture_right.getU(), texture_right.getV());
    GL11.glVertex3f(size + position.getX(), size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(texture_right.getU(), texture_right.getV2());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), size + position.getZ());
}

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

License:Open Source License

private void render_bottom() {
    if (texture_bottom == null) {
        texture_bottom = TextureLibrary.placeholder;
    }/*from ww  w. ja v  a2 s  .c  o m*/
    GL11.glNormal3f(0, -1, 0);
    GL11.glTexCoord2f(texture_bottom.getU2(), texture_bottom.getV());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(texture_bottom.getU(), texture_bottom.getV());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(texture_bottom.getU(), texture_bottom.getV2());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(texture_bottom.getU2(), texture_bottom.getV2());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), size + position.getZ());
}

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

License:Open Source License

@Override
public void _render() {
    if (texture == null) {
        texture = TextureLibrary.placeholder;
    }//from   w ww.  ja  v  a 2  s  .co  m
    if (parallel) {
        GL11.glNormal3f(0f, 0f, 1f);
        GL11.glTexCoord2f(texture.getU(), texture.getV2());
        GL11.glVertex3f(-size + position.getX(), -size + position.getY(), position.getZ());
        GL11.glTexCoord2f(texture.getU2(), texture.getV2());
        GL11.glVertex3f(size + position.getX(), -size + position.getY(), position.getZ());
        GL11.glTexCoord2f(texture.getU2(), texture.getV());
        GL11.glVertex3f(size + position.getX(), size + position.getY(), position.getZ());
        GL11.glTexCoord2f(texture.getU(), texture.getV());
        GL11.glVertex3f(-size + position.getX(), size + position.getY(), position.getZ());
    } else {
        GL11.glNormal3f(-1, 0, 0);
        GL11.glTexCoord2f(texture.getU(), texture.getV2());
        GL11.glVertex3f(position.getX(), -size + position.getY(), -size + position.getZ());
        GL11.glTexCoord2f(texture.getU2(), texture.getV2());
        GL11.glVertex3f(position.getX(), -size + position.getY(), size + position.getZ());
        GL11.glTexCoord2f(texture.getU2(), texture.getV());
        GL11.glVertex3f(position.getX(), size + position.getY(), size + position.getZ());
        GL11.glTexCoord2f(texture.getU(), texture.getV());
        GL11.glVertex3f(position.getX(), size + position.getY(), -size + position.getZ());
    }
}

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

License:Open Source License

@Override
public void _render() {
    GL11.glEnd();/*  w w w . j ava 2 s . co  m*/

    float size_x = size().getX() / 2f;
    float size_y = size().getY() / 2f + 0.025f; // HARD SET!
    GL11.glPushMatrix();
    GL11.glTranslatef(position().getX(), position().getY(), position().getZ());
    FloatBuffer modelview = BufferUtils.createFloatBuffer(16);
    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview);
    for (int i = 0; i < 3; i += 2) {
        for (int j = 0; j < 3; j++) {
            if (i == j) {
                modelview.put(i * 4 + j, 1.0f);
            } else {
                modelview.put(i * 4 + j, 0.0f);
            }
        }
    }
    GL11.glLoadMatrix(modelview);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glNormal3f(0f, 0f, 1f);
    GL11.glTexCoord2f(texture[state].getU(), texture[state].getV2());
    GL11.glVertex2f(-size_x, -size_y);
    GL11.glTexCoord2f(texture[state].getU2(), texture[state].getV2());
    GL11.glVertex2f(size_x, -size_y);
    GL11.glTexCoord2f(texture[state].getU2(), texture[state].getV());
    GL11.glVertex2f(size_x, size_y);
    GL11.glTexCoord2f(texture[state].getU(), texture[state].getV());
    GL11.glVertex2f(-size_x, size_y);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glBegin(GL11.GL_QUADS);
}

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

License:Open Source License

@Override
public void tick() throws Exception {
    _core._input.mouse(false);//from w ww.  j  a  v a 2  s  .  co m
    _core._texture.game_atlas.bind();
    _core._game._level._render();
    _core._display.mode_2D();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(texture_background.getU(), texture_background.getV());
    GL11.glVertex2f(0, 0);
    GL11.glTexCoord2f(texture_background.getU2(), texture_background.getV());
    GL11.glVertex2f(_core._display.width(), 0);
    GL11.glTexCoord2f(texture_background.getU2(), texture_background.getV2());
    GL11.glVertex2f(_core._display.width(), _core._display.height());
    GL11.glTexCoord2f(texture_background.getU(), texture_background.getV2());
    GL11.glVertex2f(0, _core._display.height());
    button_tryagain.tick();
    GL11.glEnd();
    _core._font.button.render_centred((int) button_tryagain.getCenterX(), (int) button_tryagain.getCenterY(),
            button_tryagain_text);
    // Title
    _core._font.title.render_centred(_core._display.width() / 2, 80, title_text);
    _core._display.mode_3D();
    if (button_tryagain.clicked()) {
        Mouse.setCursorPosition((int) (button_tryagain.getX() + (button_tryagain.width() / 2)),
                (int) (button_tryagain.getY() - button_tryagain.height()));
        _core._game._level.reload();
    }
}

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

License:Open Source License

private void render_background() {
    GL11.glBegin(GL11.GL_QUADS);/*from  w w  w  .  j a v a2 s  .  c o  m*/
    GL11.glTexCoord2f(texture_background.getU(), texture_background.getV());
    GL11.glVertex2f(0, 0);
    GL11.glTexCoord2f(texture_background.getU2(), texture_background.getV());
    GL11.glVertex2f(_core._display.width(), 0);
    GL11.glTexCoord2f(texture_background.getU2(), texture_background.getV2());
    GL11.glVertex2f(_core._display.width(), _core._display.height());
    GL11.glTexCoord2f(texture_background.getU(), texture_background.getV2());
    GL11.glVertex2f(0, _core._display.height());
}

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

License:Open Source License

@Override
public void tick() throws Exception {
    _core._display.prepare();/*w w w .j  av  a 2s. c o m*/
    _core._display.mode_2D();
    Texture texture = TextureLoader.getTexture("PNG", getClass().getResourceAsStream("image/splash/flob.png"));
    texture.bind();
    int x1 = (_core._display.width() / 2) - (texture.getTextureWidth() / 2);
    int y1 = (_core._display.height() / 2) - (texture.getTextureHeight() / 2);
    int x2 = (_core._display.width() / 2) + (texture.getTextureWidth() / 2);
    int y2 = (_core._display.height() / 2) + (texture.getTextureHeight() / 2);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(x1, y1);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(x2, y1);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(x2, y2);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(x1, y2);
    GL11.glEnd();
    _core._display.mode_3D();
    _core._display.update();
}

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

License:Open Source License

private void render_background() {
    Texture texture = _core._texture.title_background;
    texture.bind();// w w w .  j  a  va2s  . c  om
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(0, 0);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(texture.getTextureWidth(), 0);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(0, texture.getTextureHeight());
    GL11.glEnd();

    // Due to a limit in the font size the title_overlay has to be an image
    texture = _core._texture.title_overlay;
    texture.bind();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(0, 0);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(texture.getTextureWidth(), 0);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(0, texture.getTextureHeight());
    GL11.glEnd();
}

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

License:Open Source License

private void render_background() {
    Texture texture = _core._texture.title_background;
    texture.bind();//  w  ww  .  j  a  va 2  s .  com
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(0, 0);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(texture.getTextureWidth(), 0);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(0, texture.getTextureHeight());
    GL11.glEnd();

    texture = _core._texture.title_help;
    texture.bind();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(0, 0);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(texture.getTextureWidth(), 0);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(texture.getTextureWidth(), texture.getTextureHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(0, texture.getTextureHeight());
    GL11.glEnd();
}