Example usage for org.lwjgl.opengl GL11 glVertex2i

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

Introduction

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

Prototype

public static native void glVertex2i(@NativeType("GLint") int x, @NativeType("GLint") int y);

Source Link

Document

Integer version of #glVertex2f Vertex2f .

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

License:Open Source License

@Override
public void tick() throws Exception {
    _core._display.prepare();//w ww .  j a  v  a 2  s  .com
    _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  v  a 2  s.  c o m
    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();/*from  w  ww.j a v a  2  s  . c  o m*/
    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();
}

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(
            ((_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(//  ww w  . j ava2 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].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.StateSplash.java

License:Open Source License

@Override
public void tick() throws Exception {
    _core._display.prepare();/*from  w w  w  .  j a  v  a  2 s.c  o m*/
    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: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//  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();
}

From source file:itemrender.client.RenderTickHandler.java

License:MIT License

@SubscribeEvent
public void tick(TickEvent.RenderTickEvent event) {
    if (event.phase == TickEvent.Phase.END)
        if (keybindToRender != null && renderPreview) {
            int originalTexture = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);

            // Bind framebuffer texture
            keybindToRender.fbo.bind();//w w  w  . j  a v  a 2 s.  c om
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glTexCoord2f(0, 0);
            GL11.glVertex2i(0, 0);
            GL11.glTexCoord2f(0, 1);
            GL11.glVertex2i(0, 128);
            GL11.glTexCoord2f(1, 1);
            GL11.glVertex2i(128, 128);
            GL11.glTexCoord2f(1, 0);
            GL11.glVertex2i(128, 0);
            GL11.glEnd();

            // Restore old texture
            GlStateManager.bindTexture(originalTexture);
        }
}

From source file:myfirstgame.grass.java

public void drawGrass(int x, int y, Texture tex) {
    //grass background
    gx = x;//from  w ww .  ja v  a  2s  . com
    gy = y;

    tex.bind();
    GL11.glBegin(GL_QUADS);
    GL11.glTexCoord2f(0, 1);
    GL11.glVertex2i(gx, gy);
    GL11.glTexCoord2f(1, 1);
    GL11.glVertex2i(gx + sizeX, gy);
    GL11.glTexCoord2f(1, 0);
    GL11.glVertex2i(gx + sizeX, gy + sizeY);
    GL11.glTexCoord2f(0, 0);
    GL11.glVertex2i(gx, gy + sizeY);
    GL11.glEnd();
    outline();
}

From source file:name.martingeisse.minimal.simulation.subject.FullySimulatedSubject.java

License:Open Source License

@Override
public void drawCell(final int x, final int y, int pattern) {
    if (pattern < 0 || pattern > 15) {
        pattern = 0;/*from   w  ww.  jav  a 2  s.  co  m*/
    }
    switch (pattern) {

    case 0:
        GL11.glColor3f(0.0f, 0.0f, 0.0f);
        break;

    case 1:
        GL11.glColor3f(0.0f, 0.0f, 0.5f);
        break;

    case 2:
        GL11.glColor3f(0.0f, 0.5f, 0.0f);
        break;

    case 3:
        GL11.glColor3f(0.0f, 0.5f, 0.5f);
        break;

    case 4:
        GL11.glColor3f(0.5f, 0.0f, 0.0f);
        break;

    case 5:
        GL11.glColor3f(0.5f, 0.0f, 0.5f);
        break;

    case 6:
        GL11.glColor3f(0.5f, 0.5f, 0.0f);
        break;

    case 7:
        GL11.glColor3f(0.75f, 0.75f, 0.75f);
        break;

    case 8:
        GL11.glColor3f(0.5f, 0.5f, 0.5f);
        break;

    case 9:
        GL11.glColor3f(0.0f, 0.0f, 1.0f);
        break;

    case 10:
        GL11.glColor3f(0.0f, 1.0f, 0.0f);
        break;

    case 11:
        GL11.glColor3f(0.0f, 1.0f, 1.0f);
        break;

    case 12:
        GL11.glColor3f(1.0f, 0.0f, 0.0f);
        break;

    case 13:
        GL11.glColor3f(1.0f, 0.0f, 1.0f);
        break;

    case 14:
        GL11.glColor3f(1.0f, 1.0f, 0.0f);
        break;

    case 15:
        GL11.glColor3f(1.0f, 1.0f, 1.0f);
        break;

    }
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2i(x * 20, y * 20);
    GL11.glVertex2i(x * 20 + 20, y * 20);
    GL11.glVertex2i(x * 20 + 20, y * 20 + 20);
    GL11.glVertex2i(x * 20, y * 20 + 20);
    GL11.glEnd();
}