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

License:Open Source License

private void render_front() {
    GL11.glNormal3f(0f, 0f, 1f);/*from   ww  w.j ava2  s. c om*/
    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());
    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());
}

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

License:Open Source License

private void render_back() {
    GL11.glNormal3f(0f, 0f, -1f);//from   ww w.j  a va 2s. co  m
    GL11.glTexCoord2f(texture.getU2(), texture.getV2());
    GL11.glVertex3f(-size + position.getX(), -size + position.getY(), -size + position.getZ());
    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());
}

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

License:Open Source License

private void render_left() {
    GL11.glNormal3f(-1, 0, 0);/* w  ww .  java2  s . com*/
    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());
    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());
}

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

License:Open Source License

private void render_right() {
    GL11.glNormal3f(1, 0, 0);/*from ww  w .j  a  v a 2s .  c o  m*/
    GL11.glTexCoord2f(texture.getU2(), texture.getV2());
    GL11.glVertex3f(size + position.getX(), -size + position.getY(), -size + position.getZ());
    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());
}

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

License:Open Source License

private void render() {
    GL11.glTexCoord2f(texture[state].getU(), texture[state].getV());
    GL11.glVertex2i(/* w w  w. j  a v a2 s.  c o m*/
            ((_armoury._barry._level._game._core._display.width() / 2)
                    - (texture[state].width() / 2 * texture_upsize)),
            _armoury._barry._level._game._core._display.height() - texture[state].height() * texture_upsize);
    GL11.glTexCoord2f(texture[state].getU2(), texture[state].getV());
    GL11.glVertex2i(
            ((_armoury._barry._level._game._core._display.width() / 2)
                    + (texture[state].width() / 2 * texture_upsize)),
            _armoury._barry._level._game._core._display.height() - texture[state].height() * texture_upsize);
    GL11.glTexCoord2f(texture[state].getU2(), texture[state].getV2());
    GL11.glVertex2i(
            ((_armoury._barry._level._game._core._display.width() / 2)
                    + (texture[state].width() / 2 * texture_upsize)),
            _armoury._barry._level._game._core._display.height());
    GL11.glTexCoord2f(texture[state].getU(), texture[state].getV2());
    GL11.glVertex2i(
            ((_armoury._barry._level._game._core._display.width() / 2)
                    - (texture[state].width() / 2 * texture_upsize)),
            _armoury._barry._level._game._core._display.height());
}

From source file:io.flob.clicker.Button.java

License:Open Source License

private void render() {
    if (selected()) {
        GL11.glColor3d(0.75f, 0.75f, 0.75f);
    }/*from ww w.jav  a2 s  .  c  o  m*/
    GL11.glTexCoord2f(_texture.getU(), _texture.getV());
    GL11.glVertex2f(position.getX(), position.getY());
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV());
    GL11.glVertex2f(position.getX() + (size.getX()), position.getY());
    GL11.glTexCoord2f(_texture.getU2(), _texture.getV2());
    GL11.glVertex2f(position.getX() + (size.getX()), position.getY() + (size.getY()));
    GL11.glTexCoord2f(_texture.getU(), _texture.getV2());
    GL11.glVertex2f(position.getX(), position.getY() + (size.getY()));
    GL11.glColor3d(1, 1, 1);
}

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

License:Open Source License

@Override
public void tick() throws Exception {
    _core._display.prepare();/*  w  w w . j a  v a2s .c  om*/
    Texture texture = TextureLoader.getTexture("PNG", getClass().getResourceAsStream("image/splash.png"));
    texture.bind();
    int x1 = (Display.getWidth() / 2) - (texture.getTextureWidth() / 2);
    int y1 = (Display.getHeight() / 2) - (texture.getTextureHeight() / 2);
    int x2 = (Display.getWidth() / 2) + (texture.getTextureWidth() / 2);
    int y2 = (Display.getHeight() / 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.update();
}

From source file:io.github.minecraftgui.controllers.Render.java

License:Open Source License

public void drawTexture(Texture texture, double x, double y, double width, double height) {
    GL11.glEnable(GL11.GL_TEXTURE_2D);/*from w  w w  .ja v a 2  s. c o m*/
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID());
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glColor4f(1, 1, 1, 1);

    GL11.glBegin(GL11.GL_QUADS);
    {
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex2d(x, y);

        GL11.glTexCoord2f(0, texture.getHeight());
        GL11.glVertex2d(x, y + height);

        GL11.glTexCoord2f(texture.getWidth(), texture.getHeight());
        GL11.glVertex2d(x + width, y + height);

        GL11.glTexCoord2f(texture.getWidth(), 0);
        GL11.glVertex2d(x + width, y);
    }
    GL11.glEnd();

    modInterface.bindMinecraftTextures();
}

From source file:io.root.gfx.glutils.GL.java

License:Apache License

public static void glTexCoord2f(float u, float v) {
    GL11.glTexCoord2f(u, v);
}

From source file:itdelatrisu.opsu.render.CurveRenderState.java

License:Open Source License

/**
 * Draw a curve to the screen that's tinted with `color`. The first time
 * this is called this caches the image result of the curve and on subsequent
 * runs it just draws the cached copy to the screen.
 * @param color tint of the curve//from   w  w  w.  j  a va  2  s.c  om
 * @param borderColor the curve border color
 * @param curve the points along the curve to be drawn
 */
public void draw(Color color, Color borderColor, Vec2f[] curve) {
    float alpha = color.a;

    // if this curve hasn't been drawn, draw it and cache the result
    if (fbo == null) {
        FrameBufferCache cache = FrameBufferCache.getInstance();
        Rendertarget mapping = cache.get(hitObject);
        if (mapping == null)
            mapping = cache.insert(hitObject);
        fbo = mapping;

        int oldFb = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
        int oldTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);

        //glGetInteger requires a buffer of size 16, even though just 4
        //values are returned in this specific case
        IntBuffer oldViewport = BufferUtils.createIntBuffer(16);
        GL11.glGetInteger(GL11.GL_VIEWPORT, oldViewport);
        EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, fbo.getID());
        GL11.glViewport(0, 0, fbo.width, fbo.height);
        GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        Colors.WHITE_FADE.a = 1.0f;
        this.draw_curve(color, borderColor, curve);
        color.a = 1f;

        GL11.glBindTexture(GL11.GL_TEXTURE_2D, oldTex);
        EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, oldFb);
        GL11.glViewport(oldViewport.get(0), oldViewport.get(1), oldViewport.get(2), oldViewport.get(3));
        Colors.WHITE_FADE.a = alpha;
    }

    // draw a fullscreen quad with the texture that contains the curve
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_TEXTURE_1D);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.getTextureID());
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glColor4f(1.0f, 1.0f, 1.0f, alpha);
    GL11.glTexCoord2f(1.0f, 1.0f);
    GL11.glVertex2i(fbo.width, 0);
    GL11.glTexCoord2f(0.0f, 1.0f);
    GL11.glVertex2i(0, 0);
    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex2i(0, fbo.height);
    GL11.glTexCoord2f(1.0f, 0.0f);
    GL11.glVertex2i(fbo.width, fbo.height);
    GL11.glEnd();
}