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.HUD.java

License:Open Source License

private void render_crosshair() {
    GL11.glTexCoord2f(crosshair_texture.getU(), crosshair_texture.getV());
    GL11.glVertex2i(((_level._game._core._display.width() / 2) - crosshair_size / 2),
            ((_level._game._core._display.height() / 2) - crosshair_size / 2));
    GL11.glTexCoord2f(crosshair_texture.getU2(), crosshair_texture.getV());
    GL11.glVertex2i(((_level._game._core._display.width() / 2) + crosshair_size / 2),
            ((_level._game._core._display.height() / 2) - crosshair_size / 2));
    GL11.glTexCoord2f(crosshair_texture.getU2(), crosshair_texture.getV2());
    GL11.glVertex2i(((_level._game._core._display.width() / 2) + crosshair_size / 2),
            ((_level._game._core._display.height() / 2) + crosshair_size / 2));
    GL11.glTexCoord2f(crosshair_texture.getU(), crosshair_texture.getV2());
    GL11.glVertex2i(((_level._game._core._display.width() / 2) - crosshair_size / 2),
            ((_level._game._core._display.height() / 2) + crosshair_size / 2));
}

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

License:Open Source License

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

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

License:Open Source License

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

    if (texture == null) {
        texture = TextureLibrary.placeholder;
    }
    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.getU(), texture.getV2());
    GL11.glVertex2f(-size, -size);
    GL11.glTexCoord2f(texture.getU2(), texture.getV2());
    GL11.glVertex2f(size, -size);
    GL11.glTexCoord2f(texture.getU2(), texture.getV());
    GL11.glVertex2f(size, size);
    GL11.glTexCoord2f(texture.getU(), texture.getV());
    GL11.glVertex2f(-size, size);
    GL11.glEnd();
    GL11.glPopMatrix();

    GL11.glBegin(GL11.GL_QUADS);
}

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

License:Open Source License

private void render_front() {
    TextureUV _texture;//from  ww  w.ja  va  2s . c o  m
    float offset = -Level.texture_bleed_offset;
    if (parallel) {
        _texture = texture_face;
    } else {
        _texture = texture_side;
    }
    GL11.glNormal3f(0f, 0f, 1f);
    GL11.glTexCoord2f(_texture.getU(), _texture.getV2());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV2());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV());
    GL11.glVertex3f(size + position.getX(), size + position.getY(), size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU(), _texture.getV());
    GL11.glVertex3f(-size + position.getX(), size + position.getY(), size + position.getZ() + offset);
}

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

License:Open Source License

private void render_back() {
    TextureUV _texture;/*ww  w  .  j a v  a  2  s  .co m*/
    float offset;
    if (parallel) {
        _texture = texture_face;
        offset = Level.texture_bleed_offset;
    } else {
        _texture = texture_side;
        offset = -Level.texture_bleed_offset;
    }
    GL11.glNormal3f(0f, 0f, -1f);
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV2());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), -size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV());
    GL11.glVertex3f(-size + position.getX(), size + position.getY(), -size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU(), _texture.getV());
    GL11.glVertex3f(size + position.getX(), size + position.getY(), -size + position.getZ() + offset);
    GL11.glTexCoord2f(_texture.getU(), _texture.getV2());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), -size + position.getZ() + offset);
}

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

License:Open Source License

private void render_left() {
    TextureUV _texture;/*  w ww . j  a  v  a  2 s. c om*/
    float offset = Level.texture_bleed_offset;
    if (parallel) {
        _texture = texture_side;
    } else {
        _texture = texture_face;
    }
    GL11.glNormal3f(-1, 0, 0);
    GL11.glTexCoord2f(_texture.getU(), _texture.getV2());
    GL11.glVertex3f(-size + position.getX() + offset, -size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV2());
    GL11.glVertex3f(-size + position.getX() + offset, -size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV());
    GL11.glVertex3f(-size + position.getX() + offset, size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(_texture.getU(), _texture.getV());
    GL11.glVertex3f(-size + position.getX() + offset, size + position.getY(), -size + position.getZ());
}

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

License:Open Source License

private void render_right() {
    TextureUV _texture;//  www  .  j  a v  a 2s. c  o m
    float offset;
    if (parallel) {
        _texture = texture_side;
        offset = -Level.texture_bleed_offset;
    } else {
        _texture = texture_face;
        offset = Level.texture_bleed_offset;
    }
    GL11.glNormal3f(1, 0, 0);
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV2());
    GL11.glVertex3f(size + position.getX() - offset, -size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV());
    GL11.glVertex3f(size + position.getX() - offset, size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(_texture.getU(), _texture.getV());
    GL11.glVertex3f(size + position.getX() - offset, size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(_texture.getU(), _texture.getV2());
    GL11.glVertex3f(size + position.getX() - offset, -size + position.getY(), size + position.getZ());
}

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

License:Open Source License

private void render_surround() {
    // Bottom// w  ww .j  av  a 2 s . c om
    GL11.glNormal3f(0, -1, 0);
    GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV());
    GL11.glVertex3f(-size + position_start.getX(), -size + position_start.getY() + Level.texture_bleed_offset,
            -size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV());
    GL11.glVertex3f(size + position_start.getX(), -size + position_start.getY() + Level.texture_bleed_offset,
            -size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV2());
    GL11.glVertex3f(size + position_start.getX(), -size + position_start.getY() + Level.texture_bleed_offset,
            size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV2());
    GL11.glVertex3f(-size + position_start.getX(), -size + position_start.getY() + Level.texture_bleed_offset,
            size + position_start.getZ());

    // Top
    GL11.glNormal3f(0, 1, 0);
    GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV());
    GL11.glVertex3f(-size + position_start.getX(), size + position_start.getY() - Level.texture_bleed_offset,
            -size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV2());
    GL11.glVertex3f(-size + position_start.getX(), size + position_start.getY() - Level.texture_bleed_offset,
            size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV2());
    GL11.glVertex3f(size + position_start.getX(), size + position_start.getY() - Level.texture_bleed_offset,
            size + position_start.getZ());
    GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV());
    GL11.glVertex3f(size + position_start.getX(), size + position_start.getY() - Level.texture_bleed_offset,
            -size + position_start.getZ());

    if (parallel) {
        // right 
        GL11.glNormal3f(1, 0, 0);
        GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV2());
        GL11.glVertex3f(size + position_start.getX() - Level.texture_bleed_offset,
                -size + position_start.getY(), -size + position_start.getZ());
        GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV());
        GL11.glVertex3f(size + position_start.getX() - Level.texture_bleed_offset, size + position_start.getY(),
                -size + position_start.getZ());
        GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV());
        GL11.glVertex3f(size + position_start.getX() - Level.texture_bleed_offset, size + position_start.getY(),
                size + position_start.getZ());
        GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV2());
        GL11.glVertex3f(size + position_start.getX() - Level.texture_bleed_offset,
                -size + position_start.getY(), size + position_start.getZ());
    } else {
        // back
        GL11.glNormal3f(0f, 0f, -1f);
        GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV2());
        GL11.glVertex3f(-size + position_start.getX(), -size + position_start.getY(),
                -size + position_start.getZ() + Level.texture_bleed_offset);
        GL11.glTexCoord2f(texture_surround.getU2(), texture_surround.getV());
        GL11.glVertex3f(-size + position_start.getX(), size + position_start.getY(),
                -size + position_start.getZ() + Level.texture_bleed_offset);
        GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV());
        GL11.glVertex3f(size + position_start.getX(), size + position_start.getY(),
                -size + position_start.getZ() + Level.texture_bleed_offset);
        GL11.glTexCoord2f(texture_surround.getU(), texture_surround.getV2());
        GL11.glVertex3f(size + position_start.getX(), -size + position_start.getY(),
                -size + position_start.getZ() + Level.texture_bleed_offset);
    }
}

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

License:Open Source License

private void render_front() {
    if (texture_front == null) {
        texture_front = TextureLibrary.placeholder;
    }//from   w  w  w. j  a v a 2s . c o  m
    GL11.glNormal3f(0f, 0f, 1f);
    GL11.glTexCoord2f(texture_front.getU(), texture_front.getV2());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(texture_front.getU2(), texture_front.getV2());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(texture_front.getU2(), texture_front.getV());
    GL11.glVertex3f(size + position.getX(), size + position.getY(), size + position.getZ());
    GL11.glTexCoord2f(texture_front.getU(), texture_front.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_back() {
    if (texture_back == null) {
        texture_back = TextureLibrary.placeholder;
    }//from  ww  w .  j a  va  2s. c  o  m
    GL11.glNormal3f(0f, 0f, -1f);
    GL11.glTexCoord2f(texture_back.getU2(), texture_back.getV2());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(texture_back.getU2(), texture_back.getV());
    GL11.glVertex3f(-size + position.getX(), size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(texture_back.getU(), texture_back.getV());
    GL11.glVertex3f(size + position.getX(), size + position.getY(), -size + position.getZ());
    GL11.glTexCoord2f(texture_back.getU(), texture_back.getV2());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), -size + position.getZ());
}