List of usage examples for org.lwjgl.opengl GL11 glVertex2f
public static native void glVertex2f(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y);
From source file:rainet.Board.java
public void draw() throws IOException { bgTex.bind();/*from w w w. 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();/*from w w w . j a v a2s .com*/ 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/* ww 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();// w w w. jav a2s .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 ww. ja v a2s . c om*/ 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 ww w . ja va 2 s . com 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:rntest.Board.java
public void drawUpsideDown() { bgtexflipped.bind();/*from w w w.ja va 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) * ((this.width - 1) - j), this.sY + (this.bY + this.wY) * ((this.height - 1) - i), this.wX, this.wY); } } }
From source file:rntest.Main.java
/** * renders the game/*from w w w. jav a2 s . c om*/ */ public void render() { Color.white.bind(); gBoard.draw(); // gBoard.drawUpsideDown(); 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++) { //447, 934 link //5, 934 virus //67 1017 int ind1 = Arrays.binarySearch(sideProgression, SIDE_YELLOW); int ind2 = Arrays.binarySearch(sideProgression, SIDE_BLUE); if (links[ind1][i] != 0) { textureLinks[Arrays.binarySearch(sideProgression, links[ind1][i])].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[ind1][i] != 0) { textureViruses[Arrays.binarySearch(sideProgression, viruses[ind1][i])].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 (links[ind2][i] != 0) { textureLinks[Arrays.binarySearch(sideProgression, links[ind2][i])].bind(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 1); GL11.glVertex2f(vx + (pwidth + pbuff) * i, py2); GL11.glTexCoord2f(1, 1); GL11.glVertex2f(vx + (pwidth + pbuff) * i + pwidth, py2); GL11.glTexCoord2f(1, 0); GL11.glVertex2f(vx + (pwidth + pbuff) * i + pwidth, py2 + pheight); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(vx + (pwidth + pbuff) * i, py2 + pheight); GL11.glEnd(); } if (viruses[ind2][i] != 0) { textureViruses[Arrays.binarySearch(sideProgression, viruses[ind2][i])].bind(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 1); GL11.glVertex2f(lx + (pwidth + pbuff) * i, py2); GL11.glTexCoord2f(1, 1); GL11.glVertex2f(lx + (pwidth + pbuff) * i + pwidth, py2); GL11.glTexCoord2f(1, 0); GL11.glVertex2f(lx + (pwidth + pbuff) * i + pwidth, py2 + pheight); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(lx + (pwidth + pbuff) * i, py2 + pheight); GL11.glEnd(); } //lx+=lx; } }
From source file:rntest.Piece.java
public void draw(float x, float y, float width, float height) { (faceUp ? textureF : textureB).bind(); GL11.glBegin(GL11.GL_QUADS);//from w w w . j a va2 s . co m 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:rtype.entity.Missile.java
License:Open Source License
public void draw() { animationCursor += animationSpeed * tick; animationCursor %= animationTextures.length; GL11.glLoadIdentity();/* ww w . j a v a2 s. c o m*/ GL11.glTranslatef(position.x, position.y, Prototyp.DEFAULT_Z); // Translate Into/Out Of The Screen By z GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.animationTextures[(int) animationCursor].getTextureId()); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glBegin(GL11.GL_QUADS); { GL11.glTexCoord2f(textureRight, textureUp); //Upper right GL11.glVertex2f(width, -height); GL11.glTexCoord2f(textureLeft, textureUp); //Upper left GL11.glVertex2f(-width, -height); GL11.glTexCoord2f(textureLeft, textureDown); //Lower left GL11.glVertex2f(-width, height); GL11.glTexCoord2f(textureRight, textureDown); // Lower right GL11.glVertex2f(width, height); } GL11.glEnd(); }