List of usage examples for org.lwjgl.opengl GL11 glTexCoord2f
public static native void glTexCoord2f(@NativeType("GLfloat") float s, @NativeType("GLfloat") float t);
From source file:game.level.entities.mobs.player.items.StandardItem.java
License:Open Source License
@Override public void Render(int ScreenX, int ScreenY) { ItemArt.Items.bind();//from w ww .j a v a 2 s . co m GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(TEXTURE_QUAD_LENGTH * XTextureRef, TEXTURE_QUAD_LENGTH * YTextureRef); GL11.glVertex3f(ScreenX, ScreenY, 0); GL11.glTexCoord2f(TEXTURE_QUAD_LENGTH * XTextureRef, TEXTURE_QUAD_LENGTH * (YTextureRef + 1)); GL11.glVertex3f(ScreenX, ScreenY + IconWidth, 0); GL11.glTexCoord2f(TEXTURE_QUAD_LENGTH * (XTextureRef + 1), TEXTURE_QUAD_LENGTH * (YTextureRef + 1)); GL11.glVertex3f(ScreenX + IconWidth, ScreenY + IconWidth, 0); GL11.glTexCoord2f(TEXTURE_QUAD_LENGTH * (XTextureRef + 1), TEXTURE_QUAD_LENGTH * YTextureRef); GL11.glVertex3f(ScreenX + IconWidth, ScreenY, 0); GL11.glEnd(); }
From source file:game.level.entities.mobs.Player.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);/* ww w . j a v a 2s.c om*/ Color.white.bind(); MobArt.Player.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, -PLAYER_HEIGHT); // Top left GL11.glTexCoord2f(18f / 64f, 18f / 64f); GL11.glVertex3f(-0.3f, -0.3f, -PLAYER_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, -PLAYER_HEIGHT); // Top left GL11.glTexCoord2f(19f / 64f, 0f / 64f); GL11.glVertex3f(0.3f, -0.3f, -PLAYER_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, -PLAYER_HEIGHT); // Top left GL11.glTexCoord2f(0, 0); GL11.glVertex3f(0.3f, 0.3f, -PLAYER_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, -PLAYER_HEIGHT); // Top left GL11.glTexCoord2f(19f / 64f, 37f / 64f); GL11.glVertex3f(-0.3f, 0.3f, -PLAYER_HEIGHT); // TOP // Top right GL11.glTexCoord2f(18f / 64f, 46f / 64f); GL11.glVertex3f(-0.3f, -0.3f, -PLAYER_HEIGHT); // Top left GL11.glTexCoord2f(0, 46f / 64f); GL11.glVertex3f(0.3f, -0.3f, -PLAYER_HEIGHT); // Bottom left GL11.glTexCoord2f(0, 64f / 64f); GL11.glVertex3f(0.3f, 0.3f, -PLAYER_HEIGHT); // Bottom left+Right GL11.glTexCoord2f(18f / 64f, 64f / 64f); GL11.glVertex3f(-0.3f, 0.3f, -PLAYER_HEIGHT); GL11.glEnd(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBegin(GL11.GL_QUADS); // HEAD GL11.glColor3f(255f / 255f, 187f / 255f, 255f / 255f); GL11.glVertex3f(-0.2f, -0.2f, -PLAYER_HEIGHT - 0.5f); GL11.glVertex3f(0.2f, -0.2f, -PLAYER_HEIGHT - 0.5f); GL11.glVertex3f(0.2f, 0.2f, -PLAYER_HEIGHT - 0.5f); GL11.glVertex3f(-0.2f, 0.2f, -PLAYER_HEIGHT - 0.5f); GL11.glVertex3f(-0.2f, -0.2f, -PLAYER_HEIGHT); GL11.glVertex3f(0.2f, -0.2f, -PLAYER_HEIGHT); GL11.glVertex3f(0.2f, -0.2f, -PLAYER_HEIGHT - 0.5f); GL11.glVertex3f(-0.2f, -0.2f, -PLAYER_HEIGHT - 0.5f); GL11.glVertex3f(0.2f, -0.2f, -PLAYER_HEIGHT); GL11.glVertex3f(0.2f, 0.2f, -PLAYER_HEIGHT); GL11.glVertex3f(0.2f, 0.2f, -PLAYER_HEIGHT - 0.5f); GL11.glVertex3f(0.2f, -0.2f, -PLAYER_HEIGHT - 0.5f); GL11.glVertex3f(0.2f, 0.2f, -PLAYER_HEIGHT); GL11.glVertex3f(-0.2f, 0.2f, -PLAYER_HEIGHT); GL11.glVertex3f(-0.2f, 0.2f, -PLAYER_HEIGHT - 0.5f); GL11.glVertex3f(0.2f, 0.2f, -PLAYER_HEIGHT - 0.5f); GL11.glVertex3f(-0.2f, 0.2f, -PLAYER_HEIGHT); GL11.glVertex3f(-0.2f, -0.2f, -PLAYER_HEIGHT); GL11.glVertex3f(-0.2f, -0.2f, -PLAYER_HEIGHT - 0.5f); GL11.glVertex3f(-0.2f, 0.2f, -PLAYER_HEIGHT - 0.5f); RenderHealthBar(); GL11.glEnd(); GL11.glRotatef(Facing * -90f, 0f, 0f, 1f); }
From source file:hud.MapDisplay.java
License:Open Source License
public void draw() { GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_LINE); GL11.glColor4f(0.0f, 0.0f, 0.4f, 1.0f); GL11.glLineWidth(2.0f);//from w w w . ja va 2 s. co m GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2i(x, y); GL11.glVertex2i(x, y + height); GL11.glVertex2i(x + width, y + height); GL11.glVertex2i(x + width, y); GL11.glEnd(); GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL); game.getMap().getMinimap().bind(); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(x, y); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(x, y + height); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(x + width, y + height); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(x + width, y); GL11.glEnd(); }
From source file:hud.StatusOverlay.java
License:Open Source License
public void draw() { int energy = Math.round(player.getMech().getEnergy() * 2.56f); int armour = Math.round(player.getMech().getArmour() * 2.56f); int baseArmour = player.getHomeBase().getLife(); int ammo = Math.round(player.getMech().getAmmo() * 2.56f); baseStatus.setValue(baseArmour);/*w w w .j a va 2 s. c o m*/ if (player.getUnitOrder() != null) { if (player.getUnitOrder().ready()) { orderReadyIcon.bind(); } else { orderProcessingIcon.bind(); } GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2i(384, 16); GL11.glTexCoord2f(0, 1); GL11.glVertex2i(384, 48); GL11.glTexCoord2f(1, 1); GL11.glVertex2i(384 + 32, 48); GL11.glTexCoord2f(1, 0); GL11.glVertex2i(384 + 32, 16); GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); } GL11.glDisable(GL11.GL_LIGHTING); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glDisable(GL11.GL_TEXTURE_2D); GL13.glActiveTexture(GL13.GL_TEXTURE1); GL11.glDisable(GL11.GL_TEXTURE_2D); energyStatus.draw(); armourStatus.draw(); baseStatus.draw(); ammoStatus.draw(); }
From source file:illarion.graphics.lwjgl.TextureLWJGL.java
License:Open Source License
/** * Generate the display list in case its needed and return the ID of the * list needed to display this texture.//from www . jav a 2 s . c o m * * @return the ID of the display list */ public int getDisplayListID() { if ((displayListID == -1) || displayListDirty) { if (displayListID == -1) { displayListID = GL11.glGenLists(1); } GL11.glNewList(displayListID, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_TRIANGLE_STRIP); GL11.glTexCoord2f(getRelX1(), getRelY2()); GL11.glVertex2f(-0.5f, -0.5f); GL11.glTexCoord2f(getRelX1(), getRelY1()); GL11.glVertex2f(-0.5f, 0.5f); GL11.glTexCoord2f(getRelX2(), getRelY2()); GL11.glVertex2f(0.5f, -0.5f); GL11.glTexCoord2f(getRelX2(), getRelY1()); GL11.glVertex2f(0.5f, 0.5f); GL11.glEnd(); GL11.glEndList(); displayListDirty = false; } return displayListID; }
From source file:im.bci.jnuit.lwjgl.LwjglNuitRenderer.java
License:Open Source License
@Override public void visit(Widget widget, TexturedBackground background) { IAnimationFrame frame = background.getPlay().getCurrentFrame(); if (null != frame) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, (Integer) frame.getImage().getId()); float x1 = widget.getX(); float x2 = widget.getX() + widget.getWidth(); float y1 = widget.getY(); float y2 = widget.getY() + widget.getHeight(); float u1 = background.isMirrorX() ? frame.getU2() : frame.getU1(); float v1 = background.isMirrorY() ? frame.getV2() : frame.getV1(); float u2 = background.isMirrorX() ? frame.getU1() : frame.getU2(); float v2 = background.isMirrorY() ? frame.getV1() : frame.getV2(); GL11.glBegin(GL11.GL_QUADS);// ww w. j a v a 2 s . c om GL11.glTexCoord2f(u1, v2); GL11.glVertex2f(x1, y2); GL11.glTexCoord2f(u2, v2); GL11.glVertex2f(x2, y2); GL11.glTexCoord2f(u2, v1); GL11.glVertex2f(x2, y1); GL11.glTexCoord2f(u1, v1); GL11.glVertex2f(x1, y1); GL11.glEnd(); } }
From source file:io.flob.blackheart.Button.java
License:Open Source License
private void render() { if (!active) { GL11.glColor3d(0.25f, 0.25f, 0.25f); } else if (selected()) { GL11.glColor3d(0.75f, 0.75f, 0.75f); }// w ww . ja v a2 s . co 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.blackheart.CollectableGold.java
License:Open Source License
@Override public void _render() { GL11.glEnd();/*from w ww. ja v a 2 s.co m*/ 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[state].getU(), _texture[state].getV2()); GL11.glVertex2f(-size(), -size()); GL11.glTexCoord2f(_texture[state].getU2(), _texture[state].getV2()); GL11.glVertex2f(size(), -size()); GL11.glTexCoord2f(_texture[state].getU2(), _texture[state].getV()); GL11.glVertex2f(size(), size()); GL11.glTexCoord2f(_texture[state].getU(), _texture[state].getV()); GL11.glVertex2f(-size(), size()); GL11.glEnd(); GL11.glPopMatrix(); GL11.glBegin(GL11.GL_QUADS); }
From source file:io.flob.blackheart.FloorBlood.java
License:Open Source License
@Override public void _render() { if (texture == null) { texture = TextureLibrary.placeholder; }/*from w w w. j a v a 2 s. c o m*/ GL11.glNormal3f(0, 1, 0); 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()); GL11.glTexCoord2f(texture.getU2(), texture.getV()); GL11.glVertex3f(size + position.getX(), size + position.getY(), -size + position.getZ()); }
From source file:io.flob.blackheart.HUD.java
License:Open Source License
private void render_info_images() { // Points//from w w w .j av a2s . co m GL11.glTexCoord2f(info_points_texture.getU(), info_points_texture.getV()); GL11.glVertex2i(_level._game._core._display.width() - (info_texture_size + info_texture_offset), info_texture_offset); GL11.glTexCoord2f(info_points_texture.getU2(), info_points_texture.getV()); GL11.glVertex2i(_level._game._core._display.width() - info_texture_offset, info_texture_offset); GL11.glTexCoord2f(info_points_texture.getU2(), info_points_texture.getV2()); GL11.glVertex2i(_level._game._core._display.width() - info_texture_offset, info_texture_offset + info_texture_size); GL11.glTexCoord2f(info_points_texture.getU(), info_points_texture.getV2()); GL11.glVertex2i(_level._game._core._display.width() - (info_texture_size + info_texture_offset), info_texture_offset + info_texture_size); // Weapon GL11.glTexCoord2f(info_weapon_texture.getU(), info_weapon_texture.getV()); GL11.glVertex2i(_level._game._core._display.width() - (info_texture_size + info_texture_offset), _level._game._core._display.height() - info_texture_offset - info_texture_size); GL11.glTexCoord2f(info_weapon_texture.getU2(), info_weapon_texture.getV()); GL11.glVertex2i(_level._game._core._display.width() - info_texture_offset, _level._game._core._display.height() - info_texture_offset - info_texture_size); GL11.glTexCoord2f(info_weapon_texture.getU2(), info_weapon_texture.getV2()); GL11.glVertex2i(_level._game._core._display.width() - info_texture_offset, _level._game._core._display.height() - info_texture_offset); GL11.glTexCoord2f(info_weapon_texture.getU(), info_weapon_texture.getV2()); GL11.glVertex2i(_level._game._core._display.width() - (info_texture_size + info_texture_offset), _level._game._core._display.height() - info_texture_offset); // Health GL11.glTexCoord2f(info_health_texture.getU(), info_health_texture.getV()); GL11.glVertex2i(info_texture_offset, _level._game._core._display.height() - info_texture_offset - info_texture_size); GL11.glTexCoord2f(info_health_texture.getU2(), info_health_texture.getV()); GL11.glVertex2i(info_texture_offset + info_texture_size, _level._game._core._display.height() - info_texture_offset - info_texture_size); GL11.glTexCoord2f(info_health_texture.getU2(), info_health_texture.getV2()); GL11.glVertex2i(info_texture_offset + info_texture_size, _level._game._core._display.height() - info_texture_offset); GL11.glTexCoord2f(info_health_texture.getU(), info_health_texture.getV2()); GL11.glVertex2i(info_texture_offset, _level._game._core._display.height() - info_texture_offset); }