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:org.terasology.logic.particles.BlockParticleEmitterSystem.java

License:Apache License

private void drawParticle() {
    glBegin(GL_QUADS);//ww  w  .  ja  v  a 2  s .  com
    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex3f(-0.5f, 0.5f, 0.0f);

    GL11.glTexCoord2f(1.0f, 0.0f);
    GL11.glVertex3f(0.5f, 0.5f, 0.0f);

    GL11.glTexCoord2f(1.0f, 1.0f);
    GL11.glVertex3f(0.5f, -0.5f, 0.0f);

    GL11.glTexCoord2f(0.0f, 1.0f);
    GL11.glVertex3f(-0.5f, -0.5f, 0.0f);
    glEnd();
}

From source file:org.terasology.particles.rendering.SpriteParticleRenderer.java

License:Apache License

@Override
public void initialise() {
    drawUnitQuad = new DisplayList(() -> {
        glBegin(GL_TRIANGLE_FAN);/*from   w w w .j  a v  a 2 s.  co  m*/
        GL11.glTexCoord2f(UNIT_QUAD_VERTICES[0] + 0.5f, -UNIT_QUAD_VERTICES[1] + 0.5f);
        GL11.glVertex3f(UNIT_QUAD_VERTICES[0], UNIT_QUAD_VERTICES[1], UNIT_QUAD_VERTICES[2]);

        GL11.glTexCoord2f(UNIT_QUAD_VERTICES[3] + 0.5f, -UNIT_QUAD_VERTICES[4] + 0.5f);
        GL11.glVertex3f(UNIT_QUAD_VERTICES[3], UNIT_QUAD_VERTICES[4], UNIT_QUAD_VERTICES[5]);

        GL11.glTexCoord2f(UNIT_QUAD_VERTICES[6] + 0.5f, -UNIT_QUAD_VERTICES[7] + 0.5f);
        GL11.glVertex3f(UNIT_QUAD_VERTICES[6], UNIT_QUAD_VERTICES[7], UNIT_QUAD_VERTICES[8]);

        GL11.glTexCoord2f(UNIT_QUAD_VERTICES[9] + 0.5f, -UNIT_QUAD_VERTICES[10] + 0.5f);
        GL11.glVertex3f(UNIT_QUAD_VERTICES[9], UNIT_QUAD_VERTICES[10], UNIT_QUAD_VERTICES[11]);
        glEnd();
    });
}

From source file:org.terasology.rendering.particles.BlockParticle.java

License:Apache License

private void drawParticle() {
    Block b = BlockManager.getInstance().getBlock(_blockType);

    glBegin(GL_QUADS);/*from   w w w  .  j  ava 2 s .  c  o  m*/
    GL11.glTexCoord2f(b.calcTextureOffsetFor(Block.SIDE.FRONT).x, b.calcTextureOffsetFor(Block.SIDE.FRONT).y);
    GL11.glVertex3f(-0.5f, -0.5f, 0.0f);

    GL11.glTexCoord2f(b.calcTextureOffsetFor(Block.SIDE.FRONT).x + TEX_SIZE,
            b.calcTextureOffsetFor(Block.SIDE.FRONT).y);
    GL11.glVertex3f(0.5f, -0.5f, 0.0f);

    GL11.glTexCoord2f(b.calcTextureOffsetFor(Block.SIDE.FRONT).x + TEX_SIZE,
            b.calcTextureOffsetFor(Block.SIDE.FRONT).y + TEX_SIZE);
    GL11.glVertex3f(0.5f, 0.5f, 0.0f);

    GL11.glTexCoord2f(b.calcTextureOffsetFor(Block.SIDE.FRONT).x,
            b.calcTextureOffsetFor(Block.SIDE.FRONT).y + TEX_SIZE);
    GL11.glVertex3f(-0.5f, 0.5f, 0.0f);
    glEnd();

}

From source file:org.voxels.platform.LWJGLOpenGLAdapter.java

License:Open Source License

@Override
public void glTexCoord2f(final float s, final float t) {
    GL11.glTexCoord2f(s, t);
}

From source file:rainet.Board.java

public void draw() throws IOException {
    bgTex.bind();/*www .j  a  v a2  s  .  c om*/
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(0, 0);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2f(Display.getWidth(), 0);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2f(Display.getWidth(), Display.getHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2f(0, Display.getHeight());
    GL11.glEnd();

    for (int i = 0; i < pieces.size(); i++) {
        for (int j = 0; j < pieces.get(i).size(); j++) {
            if (pieces.get(i).get(j) != null)
                ((Piece) pieces.get(i).get(j)).draw(this.sX + (this.bX + this.wX) * j,
                        this.sY + (this.bY + this.wY) * i, this.wX, this.wY);
        }
    }
}

From source file:rainet.Button.java

public void draw() throws IOException {
    if (isVisible) {
        bTex.bind();// w  ww.j av a  2 s  .c  o m
        GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(upsd ? 1 : 0, upsd ? 1 : 0);
        GL11.glVertex2f(sx, sy);
        GL11.glTexCoord2f(upsd ? 0 : 1, upsd ? 1 : 0);
        GL11.glVertex2f(sx + width, sy);
        GL11.glTexCoord2f(upsd ? 0 : 1, upsd ? 0 : 1);
        GL11.glVertex2f(sx + width, sy + height);
        GL11.glTexCoord2f(upsd ? 1 : 0, upsd ? 0 : 1);
        GL11.glVertex2f(sx, sy + height);
        GL11.glEnd();
    }
}

From source file:rainet.Game.java

/**
 * renders the game/*w  w w.  j  a  v  a 2  s .  c  o m*/
 */
public void render() throws IOException {
    Color.white.bind();
    gBoard.draw();
    float lx = pointToScale(440), vx = pointToScale(-2), py = pointToScale(934), py2 = pointToScale(4),
            pwidth = pointToScale(75), pheight = pointToScale(83), pbuff = pointToScale(-13);
    for (int i = 0; i < 4; i++) {
        if (links[i] != -1) {
            textureLinks[links[i] == 500 ? 0 : 1].bind();
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glTexCoord2f(0, 0);
            GL11.glVertex2f(lx + (pwidth + pbuff) * i, py);
            GL11.glTexCoord2f(1, 0);
            GL11.glVertex2f(lx + (pwidth + pbuff) * i + pwidth, py);
            GL11.glTexCoord2f(1, 1);
            GL11.glVertex2f(lx + (pwidth + pbuff) * i + pwidth, py + pheight);
            GL11.glTexCoord2f(0, 1);
            GL11.glVertex2f(lx + (pwidth + pbuff) * i, py + pheight);
            GL11.glEnd();
        }
        if (viruses[i] != -1) {
            textureViruses[viruses[i] == 500 ? 0 : 1].bind();
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glTexCoord2f(0, 0);
            GL11.glVertex2f(vx + (pwidth + pbuff) * i, py);
            GL11.glTexCoord2f(1, 0);
            GL11.glVertex2f(vx + (pwidth + pbuff) * i + pwidth, py);
            GL11.glTexCoord2f(1, 1);
            GL11.glVertex2f(vx + (pwidth + pbuff) * i + pwidth, py + pheight);
            GL11.glTexCoord2f(0, 1);
            GL11.glVertex2f(vx + (pwidth + pbuff) * i, py + pheight);
            GL11.glEnd();
        }
        if (olinks[i] != -1) {
            textureLinks[olinks[i] == 500 ? 0 : 1].bind();
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glTexCoord2f(1, 1);
            GL11.glVertex2f(vx + (pwidth + pbuff) * i, py2);
            GL11.glTexCoord2f(0, 1);
            GL11.glVertex2f(vx + (pwidth + pbuff) * i + pwidth, py2);
            GL11.glTexCoord2f(0, 0);
            GL11.glVertex2f(vx + (pwidth + pbuff) * i + pwidth, py2 + pheight);
            GL11.glTexCoord2f(1, 0);
            GL11.glVertex2f(vx + (pwidth + pbuff) * i, py2 + pheight);
            GL11.glEnd();
        }
        if (oviruses[i] != -1) {
            textureViruses[oviruses[i] == 500 ? 0 : 1].bind();
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glTexCoord2f(1, 1);
            GL11.glVertex2f(lx + (pwidth + pbuff) * i, py2);
            GL11.glTexCoord2f(0, 1);
            GL11.glVertex2f(lx + (pwidth + pbuff) * i + pwidth, py2);
            GL11.glTexCoord2f(0, 0);
            GL11.glVertex2f(lx + (pwidth + pbuff) * i + pwidth, py2 + pheight);
            GL11.glTexCoord2f(1, 0);
            GL11.glVertex2f(lx + (pwidth + pbuff) * i, py2 + pheight);
            GL11.glEnd();
        }

    }

    for (Button b : buttons) {
        b.draw();
    }

    if (selectedP[0] != -1 && selectedP[1] != -1)
        gBoard.drawSelect(selectedP[0], selectedP[1]);

}

From source file:rainet.Piece.java

public void draw(float x, float y, float width, float height) throws IOException {
    if (pTexF == null)
        this.pTexF = TextureLoader.getTexture("PNG",
                ResourceLoader.getResourceAsStream("res/piece" + this.sID + this.pID + "_front.png"));
    if (pTexB == null)
        this.pTexB = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(
                "res/piece" + this.sID + this.pID + (this.sID == Game.mySide ? "_fade.png" : "_back.png")));
    (faceUp ? pTexF : pTexB).bind();//from   w w  w.jav a 2 s  .  c  o  m
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(x, y);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2f(x + width, y);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2f(x + width, y + height);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2f(x, y + height);
    GL11.glEnd();
}

From source file:rainet.Piece.java

public void drawSelect(float x, float y, float width, float height) throws IOException {
    Game.selectedT.bind();/*from   w w w  . j  a  v  a  2 s  .  c  o  m*/
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(x, y);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2f(x + width, y);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2f(x + width, y + height);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2f(x, y + height);
    GL11.glEnd();
}

From source file:rntest.Board.java

public void draw() {
    bgtex.bind();/*from w w  w .  j a v  a 2  s  . co  m*/
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2f(0, 0);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2f(Display.getWidth(), 0);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2f(Display.getWidth(), Display.getHeight());
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2f(0, Display.getHeight());
    GL11.glEnd();

    for (int i = 0; i < pieces.size(); i++) {
        for (int j = 0; j < pieces.get(i).size(); j++) {
            if (pieces.get(i).get(j) != null)
                ((Piece) pieces.get(i).get(j)).draw(this.sX + (this.bX + this.wX) * j,
                        this.sY + (this.bY + this.wY) * i, this.wX, this.wY);
        }
    }

}