List of usage examples for org.lwjgl.opengl GL11 glEnd
public static native void glEnd();
From source file:mwisbest.openbase.gui.Button.java
License:Open Source License
@Override public void render() { GL11.glPushMatrix();/*from ww w . jav a2 s . c o m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthMask(false); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if (Common.currentTextureID != this.texture.getTextureID()) { int texID = this.texture.getTextureID(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID); Common.currentTextureID = texID; } GL11.glTranslatef(this.x, this.y, 0); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(0, this.texture.getHeight()); GL11.glVertex2f(0, this.height); GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight()); GL11.glVertex2f(this.width, this.height); GL11.glTexCoord2f(this.texture.getWidth(), 0); GL11.glVertex2f(this.width, 0); GL11.glEnd(); GL11.glPopMatrix(); }
From source file:mwisbest.openbase.opengl.UtilsGL.java
License:Open Source License
/** * Draws the specified texture to positions x and y on the screen and scaled with the specified width and height * /* w w w . j a va2 s . c om*/ * @param texture * @param x * @param y * @param width * @param height */ public static void drawTexture(Texture texture, int x, int y, int width, int height) { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthMask(false); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if (Common.currentTextureID != texture.getTextureID()) { int texID = texture.getTextureID(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID); Common.currentTextureID = texID; } GL11.glTranslatef(x, y, 0); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(0, texture.getHeight()); GL11.glVertex2f(0, height); GL11.glTexCoord2f(texture.getWidth(), texture.getHeight()); GL11.glVertex2f(width, height); GL11.glTexCoord2f(texture.getWidth(), 0); GL11.glVertex2f(width, 0); GL11.glEnd(); GL11.glPopMatrix(); }
From source file:myfirstgame.bullet.java
public void drawBullet(int x, int y, Texture tex) { tex.bind();/*from w w w .j ava 2 s. co m*/ GL11.glBegin(GL_QUADS); GL11.glTexCoord2f(0, 1); glVertex2f(x, y); GL11.glTexCoord2f(1, 1); glVertex2f(x + sizeX, y); GL11.glTexCoord2f(1, 0); glVertex2f(x + sizeX, y + sizeY); GL11.glTexCoord2f(0, 0); glVertex2f(x, y + sizeY); GL11.glEnd(); }
From source file:myfirstgame.cursor.java
public void draw(Texture tex) { tex.bind();//from w ww . j a v a 2 s . c o m GL11.glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex2i(Mouse.getX() - 12, Mouse.getY() - 12); glTexCoord2f(1, 1); glVertex2i(Mouse.getX() - 12 + 25, Mouse.getY() - 12); glTexCoord2f(1, 0); glVertex2i(Mouse.getX() - 12 + 25, Mouse.getY() - 12 + 25); glTexCoord2f(0, 0); glVertex2i(Mouse.getX() - 12, Mouse.getY() - 12 + 25); GL11.glEnd(); }
From source file:myfirstgame.Game.java
public void menu(Texture tex) { int x = 200, y = 200; tex.bind();/*from w ww .j a va 2 s . c o m*/ GL11.glBegin(GL_QUADS); GL11.glTexCoord2f(0, 1); glVertex2i(x, y); GL11.glTexCoord2f(1, 1); glVertex2i(x + 200, y); GL11.glTexCoord2f(1, 0); glVertex2i(x + 200, y + 200); GL11.glTexCoord2f(0, 0); glVertex2i(x, y + 200); GL11.glEnd(); }
From source file:myfirstgame.grass.java
public void outline() { GL11.glLineWidth((float) 2.5); GL11.glColor3f(255, 0, 0);/*from w ww . ja v a 2 s . co m*/ GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(gx, gy); GL11.glVertex2f(gx, gy + sizeY); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(gx, gy + sizeY); GL11.glVertex2f(gx + sizeX, gy + sizeY); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(gx + sizeX, gy + sizeY); GL11.glVertex2f(gx + sizeX, gy); GL11.glEnd(); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(gx + sizeX, gy); GL11.glVertex2f(gx, gy); GL11.glEnd(); GL11.glColor3f(255, 255, 255); }
From source file:myfirstgame.grass.java
public void drawGrass(int x, int y, Texture tex) { //grass background gx = x;/* w w w .ja v a 2 s .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:myfirstgame.horsemask.java
@Override public void draw(Texture tex) { tex.bind();// w ww .j a va2 s . c om GL11.glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex2i(x, y); glTexCoord2f(1, 1); glVertex2i(x + sizeX, y); glTexCoord2f(1, 0); glVertex2i(x + sizeX, y + sizeY); glTexCoord2f(0, 0); glVertex2i(x, y + sizeY); GL11.glEnd(); if (active) { if (Game.player.direction == "left") { tex.bind(); GL11.glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex2i(Game.player.x, Game.player.y + 15); glTexCoord2f(1, 1); glVertex2i(Game.player.x + sizeX, Game.player.y + 15); glTexCoord2f(1, 0); glVertex2i(Game.player.x + sizeX, Game.player.y + 15 + sizeY); glTexCoord2f(0, 0); glVertex2i(Game.player.x, Game.player.y + 15 + sizeY); GL11.glEnd(); } else { tex.bind(); GL11.glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex2i(Game.player.x - 4, Game.player.y + 15); glTexCoord2f(1, 1); glVertex2i(Game.player.x - 4 + sizeX, Game.player.y + 15); glTexCoord2f(1, 0); glVertex2i(Game.player.x - 4 + sizeX, Game.player.y + 15 + sizeY); glTexCoord2f(0, 0); glVertex2i(Game.player.x - 4, Game.player.y + 15 + sizeY); GL11.glEnd(); } } }
From source file:myfirstgame.Spinner.java
public void outline(Texture tex) { tex.bind();// w w w . ja v a2 s. c om GL11.glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex2i(x, y); glTexCoord2f(1, 1); glVertex2i(x + sizeX, y); glTexCoord2f(1, 0); glVertex2i(x + sizeX, y + sizeY); glTexCoord2f(0, 0); glVertex2i(x, y + sizeY); GL11.glEnd(); System.out.println("X - " + x + "Y - " + y); }
From source file:myfirstgame.Spinner.java
public void draw(Texture tex) { //outline();//from w w w .j a v a2s . c o m tex.bind(); GL11.glBegin(GL_QUADS); glTexCoord2f(0, 1); glVertex2i(x, y); glTexCoord2f(1, 1); glVertex2i(x + sizeX, y); glTexCoord2f(1, 0); glVertex2i(x + sizeX, y + sizeY); glTexCoord2f(0, 0); glVertex2i(x, y + sizeY); GL11.glEnd(); }