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:game.graphics.GUI_Button.java

License:Open Source License

public void Render() {
    texture.bind();/*from w w w. j  a  va 2  s .  c  o m*/
    GL11.glBegin(GL11.GL_QUADS);

    GL11.glTexCoord2f(0, 0);
    GL11.glVertex3f(ScreenX, ScreenY, 0);

    GL11.glTexCoord2f(0, 1);
    GL11.glVertex3f(ScreenX, ScreenY + ScreenButtonHeight * (MouseInsideMe ? MouseOverMultiplier : 1), 0);

    GL11.glTexCoord2f(1, 1);
    GL11.glVertex3f(ScreenX + ScreenButtonWidth * (MouseInsideMe ? MouseOverMultiplier : 1),
            ScreenY + ScreenButtonHeight * (MouseInsideMe ? MouseOverMultiplier : 1), 0);

    GL11.glTexCoord2f(1, 0);
    GL11.glVertex3f(ScreenX + ScreenButtonWidth * (MouseInsideMe ? MouseOverMultiplier : 1), ScreenY, 0);

    GL11.glEnd();

}

From source file:game.graphics.GUI_Console.java

License:Open Source License

public void Render() {
    if (Enabled) {
        texture.bind();/*from   w  ww  .  j  a  va  2  s.com*/
        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(ScreenX, ScreenY, 0);

        GL11.glTexCoord2f(0, 1);
        GL11.glVertex3f(ScreenX, ScreenY + ScreenButtonHeight, 0);

        GL11.glTexCoord2f(1, 1);
        GL11.glVertex3f(ScreenX + ScreenButtonWidth, ScreenY + ScreenButtonHeight, 0);

        GL11.glTexCoord2f(1, 0);
        GL11.glVertex3f(ScreenX + ScreenButtonWidth, ScreenY, 0);

        GL11.glEnd();
        font.drawString(ScreenX + 10, ScreenY + 10, Log, Color.green);
        font.drawString(ScreenX + 10, ScreenY + ScreenButtonHeight - 30, "> " + Prompt, Color.green);
    }

}

From source file:game.graphics.GUI_InvDisplay.java

License:Open Source License

@Override
public void Render() {
    if (Enabled) {

        texture.bind();/* www.  java 2s. co  m*/

        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(ScreenX, ScreenY, 0);

        GL11.glTexCoord2f(0, 1);
        GL11.glVertex3f(ScreenX, ScreenY + ScreenButtonHeight, 0);

        GL11.glTexCoord2f(1, 1);
        GL11.glVertex3f(ScreenX + ScreenButtonWidth, ScreenY + ScreenButtonHeight, 0);

        GL11.glTexCoord2f(1, 0);
        GL11.glVertex3f(ScreenX + ScreenButtonWidth, ScreenY, 0);

        GL11.glEnd();

        for (int i = 0; i < Buttons.size(); i++) {
            Buttons.get(i).Render();
        }

        player.getInventory().Render(ScreenX + 230, ScreenY + 30, font);

    }

}

From source file:game.graphics.GUI_Object.java

License:Open Source License

private void RenderBackground() {
    texture.bind();//  ww  w. j  a v a 2 s  . co  m
    GL11.glBegin(GL11.GL_QUADS);

    GL11.glTexCoord2f(0, 0);
    GL11.glVertex3f(EntityWindowX, EntityWindowY, 0);

    GL11.glTexCoord2f(0, 1);
    GL11.glVertex3f(EntityWindowX, EntityWindowY + EntityHeight, 0);

    GL11.glTexCoord2f(1, 1);
    GL11.glVertex3f(EntityWindowX + EntityWidth, EntityWindowY + EntityHeight, 0);

    GL11.glTexCoord2f(1, 0);
    GL11.glVertex3f(EntityWindowX + EntityWidth, EntityWindowY, 0);

    GL11.glEnd();
}

From source file:game.graphics.GUI_StatDisplay.java

License:Open Source License

@Override
public void Render() {
    if (Enabled) {
        texture.bind();//from w ww  .  j av a 2s . com

        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(ScreenX, ScreenY, 0);

        GL11.glTexCoord2f(0, 1);
        GL11.glVertex3f(ScreenX, ScreenY + ScreenButtonHeight, 0);

        GL11.glTexCoord2f(1, 1);
        GL11.glVertex3f(ScreenX + ScreenButtonWidth, ScreenY + ScreenButtonHeight, 0);

        GL11.glTexCoord2f(1, 0);
        GL11.glVertex3f(ScreenX + ScreenButtonWidth, ScreenY, 0);

        GL11.glEnd();
        Buttons.get(0).Render();
        if (player.getLevelUpPoints() > 0) {
            for (int i = 1; i < Buttons.size(); i++) {
                Buttons.get(i).Render();
            }
        }
        font.drawString(ScreenX + 30, ScreenY + 10, "Player stats", Color.black);
        font.drawString(ScreenX + 30, ScreenY + 30, player.GetStats().getPrimaryString(), Color.black);
        font.drawString(ScreenX + 150, ScreenY + 30, player.GetStats().getPrimaryStringValues(), Color.black);
        font.drawString(ScreenX + 250, ScreenY + 30, player.GetStats().getSecondaryString(), Color.black);
        font.drawString(ScreenX + 420, ScreenY + 30, player.GetStats().getSecondaryStringValues(), Color.black);
        font.drawString(ScreenX + 30, ScreenY + 250,
                "Level up points: " + Integer.toString(player.getLevelUpPoints()), Color.black);

    }

}

From source file:game.graphics.GUI_Stats.java

License:Open Source License

private void DrawExperienceBar() {
    if (ExpTexture != null) {
        ExpTexture.bind();//ww  w.jav  a 2 s. co  m
        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(225, 704, 0);

        GL11.glTexCoord2f(0, 1);
        GL11.glVertex3f(225, 763, 0);

        GL11.glTexCoord2f(1, 1);
        GL11.glVertex3f(225 + 843f * player.Experience / player.GetExpNeedToLevel(), 763, 0);

        GL11.glTexCoord2f(1, 0);
        GL11.glVertex3f(225 + 843f * player.Experience / player.GetExpNeedToLevel(), 704, 0);
        GL11.glEnd();
        String drawString = Integer.toString(player.Experience);
        font1.drawString(645.0F - (float) drawString.length() / 2 * 10, 705.0F, drawString, Color.black);
    }
}

From source file:game.graphics.GUI_Stats.java

License:Open Source License

private void DrawHealthBar() {
    if (HealthTexture != null) {
        HealthTexture.bind();//  www .  j a  v a2  s. c om
        GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(226, 701 - 54 * player.GetStats().GetHealthPercent() / 100, 0);
        GL11.glTexCoord2f(0, 1);
        GL11.glVertex3f(226, 701, 0);

        GL11.glTexCoord2f(1, 1);
        GL11.glVertex3f(318, 701, 0);

        GL11.glTexCoord2f(1, 0);
        GL11.glVertex3f(318, 701 - 54 * player.GetStats().GetHealthPercent() / 100, 0);
        GL11.glEnd();
        String drawString = Integer.toString(player.GetStats().GetHealth());
        font1.drawString(271 - (float) drawString.length() / 2 * 10, 668.0F, drawString, Color.black);

    }
}

From source file:game.graphics.GUI_Stats.java

License:Open Source License

private void DrawManaBar() {
    if (ManaTexture != null) {
        ManaTexture.bind();//from   w ww.  j  a va  2 s .  c o  m
        GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(978, 701 - 54 * player.GetStats().GetManaPercent() / 100, 0);
        GL11.glTexCoord2f(0, 1);
        GL11.glVertex3f(978, 701, 0);

        GL11.glTexCoord2f(1, 1);
        GL11.glVertex3f(1070, 701, 0);

        GL11.glTexCoord2f(1, 0);
        GL11.glVertex3f(1070, 701 - 54 * player.GetStats().GetManaPercent() / 100, 0);
        GL11.glEnd();
        String drawString = Integer.toString(player.GetStats().GetMana());
        font1.drawString(1020 - (float) drawString.length() / 2 * 10, 668.0F, drawString, Color.black);
    }
}

From source file:game.level.entities.mobs.enemies.Bandit.java

License:Open Source License

@Override
public void Render(int x, int y) {
    GL11.glRotatef(Facing * 90f, 0f, 0f, 1f);
    GL11.glEnable(GL11.GL_TEXTURE_2D);/*from   www  .  ja  va  2s .  c  o m*/
    Color.white.bind();
    MobArt.Bandit.bind();
    GL11.glBegin(GL11.GL_QUADS);

    GL11.glTexCoord2f(0, 0);
    GL11.glVertex3f(-0.3f, -0.3f, 0);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex3f(0.3f, -0.3f, 0);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex3f(0.3f, 0.3f, 0);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex3f(-0.3f, 0.3f, 0);

    // Topwards side
    // Top right
    GL11.glTexCoord2f(64f / 64f, 18f / 64f);
    GL11.glVertex3f(-0.3f, -0.3f, 0);
    // Bottom left+Right
    GL11.glTexCoord2f(64f / 64f, 36f / 64f);
    GL11.glVertex3f(0.3f, -0.3f, 0);
    // Bottom left
    GL11.glTexCoord2f(18 / 64f, 36f / 64f);
    GL11.glVertex3f(0.3f, -0.3f, -MOB_HEIGHT);

    // Top left
    GL11.glTexCoord2f(18f / 64f, 18f / 64f);
    GL11.glVertex3f(-0.3f, -0.3f, -MOB_HEIGHT);

    // Rightwards side
    // Top right
    GL11.glTexCoord2f(64f / 64f, 0f / 64f);
    GL11.glVertex3f(0.3f, -0.3f, 0);
    // Bottom Right
    GL11.glTexCoord2f(64f / 64f, 18f / 64f);
    GL11.glVertex3f(0.3f, 0.3f, 0);
    // Bottom left
    GL11.glTexCoord2f(19 / 64f, 18f / 64f);
    GL11.glVertex3f(0.3f, 0.3f, -MOB_HEIGHT);
    // Top left
    GL11.glTexCoord2f(19f / 64f, 0f / 64f);
    GL11.glVertex3f(0.3f, -0.3f, -MOB_HEIGHT);

    // Front
    // Bottom left
    GL11.glTexCoord2f(0, 46f / 64f);
    GL11.glVertex3f(0.3f, 0.3f, 0);
    // Bottom left+Right
    GL11.glTexCoord2f(18f / 64f, 46f / 64f);
    GL11.glVertex3f(-0.3f, 0.3f, 0);

    // Top right
    GL11.glTexCoord2f(18f / 64f, 0);
    GL11.glVertex3f(-0.3f, 0.3f, -MOB_HEIGHT);
    // Top left
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex3f(0.3f, 0.3f, -MOB_HEIGHT);

    // Leftwards Side
    // Top right
    GL11.glTexCoord2f(64f / 64f, 37f / 64f);
    GL11.glVertex3f(-0.3f, 0.3f, 0);
    // Bottom left+Right
    GL11.glTexCoord2f(64f / 64f, 54f / 64f);
    GL11.glVertex3f(-0.3f, -0.3f, 0);
    // Bottom left
    GL11.glTexCoord2f(19 / 64f, 54f / 64f);
    GL11.glVertex3f(-0.3f, -0.3f, -MOB_HEIGHT);
    // Top left
    GL11.glTexCoord2f(19f / 64f, 37f / 64f);
    GL11.glVertex3f(-0.3f, 0.3f, -MOB_HEIGHT);

    // TOP
    // Top right
    GL11.glTexCoord2f(18f / 64f, 46f / 64f);
    GL11.glVertex3f(-0.3f, -0.3f, -MOB_HEIGHT);
    // Top left
    GL11.glTexCoord2f(0, 46f / 64f);
    GL11.glVertex3f(0.3f, -0.3f, -MOB_HEIGHT);
    // Bottom left
    GL11.glTexCoord2f(0, 64f / 64f);
    GL11.glVertex3f(0.3f, 0.3f, -MOB_HEIGHT);
    // Bottom left+Right
    GL11.glTexCoord2f(18f / 64f, 64f / 64f);
    GL11.glVertex3f(-0.3f, 0.3f, -MOB_HEIGHT);
    GL11.glEnd();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBegin(GL11.GL_QUADS);
    RenderHealthBar();
    GL11.glEnd();
    GL11.glRotatef(Facing * -90f, 0f, 0f, 1f);

}

From source file:game.level.entities.mobs.enemies.Demon.java

License:Open Source License

@Override
public void Render(int x, int y) {
    GL11.glRotatef(Facing * 90f, 0f, 0f, 1f);
    GL11.glEnable(GL11.GL_TEXTURE_2D);/*from w  w  w.jav a 2 s  .  com*/
    Color.white.bind();
    MobArt.Demon.bind();
    GL11.glBegin(GL11.GL_QUADS);

    // Topwards side
    // Top right
    GL11.glTexCoord2f(64f / 64f, 18f / 64f);
    GL11.glVertex3f(-0.3f, -0.3f, 0);
    // Bottom left+Right
    GL11.glTexCoord2f(64f / 64f, 36f / 64f);
    GL11.glVertex3f(0.3f, -0.3f, 0);
    // Bottom left
    GL11.glTexCoord2f(18 / 64f, 36f / 64f);
    GL11.glVertex3f(0.3f, -0.3f, -MOB_HEIGHT);

    // Top left
    GL11.glTexCoord2f(18f / 64f, 18f / 64f);
    GL11.glVertex3f(-0.3f, -0.3f, -MOB_HEIGHT);

    // Rightwards side
    // Top right
    GL11.glTexCoord2f(64f / 64f, 0f / 64f);
    GL11.glVertex3f(0.3f, -0.3f, 0);
    // Bottom Right
    GL11.glTexCoord2f(64f / 64f, 18f / 64f);
    GL11.glVertex3f(0.3f, 0.3f, 0);
    // Bottom left
    GL11.glTexCoord2f(19 / 64f, 18f / 64f);
    GL11.glVertex3f(0.3f, 0.3f, -MOB_HEIGHT);
    // Top left
    GL11.glTexCoord2f(19f / 64f, 0f / 64f);
    GL11.glVertex3f(0.3f, -0.3f, -MOB_HEIGHT);

    // Front
    // Bottom left
    GL11.glTexCoord2f(0, 46f / 64f);
    GL11.glVertex3f(0.3f, 0.3f, 0);
    // Bottom left+Right
    GL11.glTexCoord2f(18f / 64f, 46f / 64f);
    GL11.glVertex3f(-0.3f, 0.3f, 0);

    // Top right
    GL11.glTexCoord2f(18f / 64f, 0);
    GL11.glVertex3f(-0.3f, 0.3f, -MOB_HEIGHT);
    // Top left
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex3f(0.3f, 0.3f, -MOB_HEIGHT);

    // Leftwards Side
    // Top right
    GL11.glTexCoord2f(64f / 64f, 37f / 64f);
    GL11.glVertex3f(-0.3f, 0.3f, 0);
    // Bottom left+Right
    GL11.glTexCoord2f(64f / 64f, 54f / 64f);
    GL11.glVertex3f(-0.3f, -0.3f, 0);
    // Bottom left
    GL11.glTexCoord2f(19 / 64f, 54f / 64f);
    GL11.glVertex3f(-0.3f, -0.3f, -MOB_HEIGHT);
    // Top left
    GL11.glTexCoord2f(19f / 64f, 37f / 64f);
    GL11.glVertex3f(-0.3f, 0.3f, -MOB_HEIGHT);

    // TOP
    // Top right
    GL11.glTexCoord2f(18f / 64f, 46f / 64f);
    GL11.glVertex3f(-0.3f, -0.3f, -MOB_HEIGHT);
    // Top left
    GL11.glTexCoord2f(0, 46f / 64f);
    GL11.glVertex3f(0.3f, -0.3f, -MOB_HEIGHT);
    // Bottom left
    GL11.glTexCoord2f(0, 64f / 64f);
    GL11.glVertex3f(0.3f, 0.3f, -MOB_HEIGHT);
    // Bottom left+Right
    GL11.glTexCoord2f(18f / 64f, 64f / 64f);
    GL11.glVertex3f(-0.3f, 0.3f, -MOB_HEIGHT);

    GL11.glEnd();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBegin(GL11.GL_QUADS);
    RenderHealthBar();
    GL11.glEnd();
    GL11.glRotatef(Facing * -90f, 0f, 0f, 1f);

}