List of usage examples for org.lwjgl.opengl GL11 glEnd
public static native void glEnd();
From source file:com.github.begla.blockmania.game.mobs.GelatinousCube.java
License:Apache License
private void generateDisplayList() { _displayListOuterBody = glGenLists(1); _displayListInnerBody = glGenLists(1); glNewList(_displayListOuterBody, GL_COMPILE); glBegin(GL_QUADS);//from w ww . j a v a 2s . c o m GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.8f); // TOP GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); // LEFT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); // BACK GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); // RIGHT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); GL11.glColor4f(0.8f, 0.8f, 0.8f, 0.8f); // FRONT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); // BOTTOM GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, -WIDTH_HALF); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF, -HEIGHT_HALF, WIDTH_HALF); GL11.glEnd(); GL11.glEndList(); glNewList(_displayListInnerBody, GL_COMPILE); glBegin(GL_QUADS); GL11.glColor4f(0.8f, 0.8f, 0.8f, 1.0f); // TOP GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); // LEFT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); // BACK GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); // RIGHT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glColor4f(0.6f, 0.6f, 0.6f, 1.0f); // FRONT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); // BOTTOM GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, -WIDTH_HALF / 2); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-WIDTH_HALF / 2, -HEIGHT_HALF / 2, WIDTH_HALF / 2); GL11.glEnd(); GL11.glEndList(); }
From source file:com.github.begla.blockmania.rendering.helper.Primitives.java
License:Apache License
public static int generateColoredBlock(Vector4f color, float size) { int id = glGenLists(1); GL11.glNewList(id, GL11.GL_COMPILE); GL11.glBegin(GL11.GL_QUADS);//from w w w . j a va2 s.c o m GL11.glColor4f(color.x, color.y, color.z, color.w); float sHalf = size / 2; // TOP GL11.glVertex3f(-sHalf, sHalf, sHalf); GL11.glVertex3f(sHalf, sHalf, sHalf); GL11.glVertex3f(sHalf, sHalf, -sHalf); GL11.glVertex3f(-sHalf, sHalf, -sHalf); // LEFT GL11.glVertex3f(-sHalf, -sHalf, -sHalf); GL11.glVertex3f(-sHalf, -sHalf, sHalf); GL11.glVertex3f(-sHalf, sHalf, sHalf); GL11.glVertex3f(-sHalf, sHalf, -sHalf); // RIGHT GL11.glVertex3f(sHalf, sHalf, -sHalf); GL11.glVertex3f(sHalf, sHalf, sHalf); GL11.glVertex3f(sHalf, -sHalf, sHalf); GL11.glVertex3f(sHalf, -sHalf, -sHalf); GL11.glColor4f(0.85f * color.x, 0.85f * color.y, 0.85f * color.z, color.w); // FRONT GL11.glVertex3f(-sHalf, sHalf, -sHalf); GL11.glVertex3f(sHalf, sHalf, -sHalf); GL11.glVertex3f(sHalf, -sHalf, -sHalf); GL11.glVertex3f(-sHalf, -sHalf, -sHalf); // BACK GL11.glVertex3f(-sHalf, -sHalf, sHalf); GL11.glVertex3f(sHalf, -sHalf, sHalf); GL11.glVertex3f(sHalf, sHalf, sHalf); GL11.glVertex3f(-sHalf, sHalf, sHalf); // BOTTOM GL11.glVertex3f(-sHalf, -sHalf, -sHalf); GL11.glVertex3f(sHalf, -sHalf, -sHalf); GL11.glVertex3f(sHalf, -sHalf, sHalf); GL11.glVertex3f(-sHalf, -sHalf, sHalf); GL11.glEnd(); GL11.glEndList(); return id; }
From source file:com.github.begla.blockmania.world.characters.Slime.java
License:Apache License
public void render() { super.render(); glPushMatrix();// w w w. j a v a2s .co m glTranslatef(getPosition().x, getPosition().y, getPosition().z); glRotatef((float) _yaw, 0f, 1f, 0f); glEnable(GL_TEXTURE_2D); TextureManager.getInstance().bindTexture("slime"); float brightness = (float) Math.pow(0.84, 15.0 - _parent.getDaylight() * 15.0); glBegin(GL_QUADS); GL11.glColor3f(brightness, brightness, brightness); // TOP GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-0.25f, 0.2f, 0.25f); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(0.25f, 0.2f, 0.25f); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(0.25f, 0.2f, -0.25f); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-0.25f, 0.2f, -0.25f); // LEFT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-0.25f, -0.2f, -0.25f); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(-0.25f, -0.2f, 0.25f); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(-0.25f, 0.2f, 0.25f); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-0.25f, 0.2f, -0.25f); // BACK GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-0.25f, -0.2f, 0.25f); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(0.25f, -0.2f, 0.25f); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(0.25f, 0.2f, 0.25f); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-0.25f, 0.2f, 0.25f); // RIGHT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(0.25f, 0.2f, -0.25f); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(0.25f, 0.2f, 0.25f); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(0.25f, -0.2f, 0.25f); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(0.25f, -0.2f, -0.25f); GL11.glColor3f(brightness * 0.25f, brightness * 0.25f, brightness * 0.25f); // FRONT GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-0.25f, 0.2f, -0.25f); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(0.25f, 0.2f, -0.25f); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(0.25f, -0.2f, -0.25f); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-0.25f, -0.2f, -0.25f); // BOTTOM GL11.glTexCoord2f(0f / 64f, 28f / 32f); GL11.glVertex3f(-0.25f, -0.2f, -0.25f); GL11.glTexCoord2f(6f / 64f, 28f / 32f); GL11.glVertex3f(0.25f, -0.2f, -0.25f); GL11.glTexCoord2f(6f / 64f, 22f / 32f); GL11.glVertex3f(0.25f, -0.2f, 0.25f); GL11.glTexCoord2f(0f / 64f, 22f / 32f); GL11.glVertex3f(-0.25f, -0.2f, 0.25f); GL11.glEnd(); glDisable(GL11.GL_TEXTURE_2D); glPopMatrix(); }
From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java
License:Open Source License
/** ************************************************************************* */ public boolean drawImage(Image img, int x, int y, ImageObserver observer) { this.startPainting(); // store the current model matrix GL11.glPushMatrix();//from www. j a v a 2s .c o m // bind to the appropriate texture for this sprite Texture texture = this.textureLoader.getTexture((BufferedImage) img); texture.bind(); // translate to the right location and prepare to draw GL11.glTranslatef(x, y, 0); // draw a quad textured to match the sprite GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(0, texture.getHeight()); GL11.glVertex2f(0, texture.getImageHeight()); GL11.glTexCoord2f(texture.getWidth(), texture.getHeight()); GL11.glVertex2f(texture.getImageWidth(), texture.getImageHeight()); GL11.glTexCoord2f(texture.getWidth(), 0); GL11.glVertex2f(texture.getImageWidth(), 0); GL11.glEnd(); // restore the model view matrix to prevent contamination GL11.glPopMatrix(); this.endPainting(); return true; }
From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java
License:Open Source License
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { this.startPainting(); GL11.glPushMatrix();/* www . jav a 2 s . c o m*/ Texture texture = this.textureLoader.getTexture((BufferedImage) img); texture.bind(); 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(); this.endPainting(); return true; }
From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java
License:Open Source License
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) { this.startPainting(); Texture texture = this.textureLoader.getTexture((BufferedImage) img); texture.bind();/* ww w. ja v a 2 s . c o m*/ float tx0 = ((float) sx1 / texture.getTextureWidth()); float tx1 = ((float) sx2 / texture.getTextureWidth()); float ty0 = ((float) sy1 / texture.getTextureHeight()); float ty1 = ((float) sy2 / texture.getTextureHeight()); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(tx0, ty0); GL11.glVertex2f(dx1, dy1); GL11.glTexCoord2f(tx1, ty0); GL11.glVertex2f(dx2, dy1); GL11.glTexCoord2f(tx1, ty1); GL11.glVertex2f(dx2, dy2); GL11.glTexCoord2f(tx0, ty1); GL11.glVertex2f(dx1, dy2); GL11.glEnd(); this.endPainting(); return true; }
From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java
License:Open Source License
public void drawLine(int x1, int y1, int x2, int y2) { GL11.glDisable(GL11.GL_TEXTURE_2D);//from w w w .j a v a2s . c o m GL11.glColor4f((float) this.color.getRed() / 255f, (float) this.color.getGreen() / 255f, (float) this.color.getBlue() / 255f, (float) this.color.getAlpha() / 255f); GL11.glLineWidth(1.0f); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2f(x1, y1); GL11.glVertex2f(x2, y2); GL11.glEnd(); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java
License:Open Source License
private void drawRect(int x, int y, int width, int height, int type, Color col) { GL11.glDisable(GL11.GL_TEXTURE_2D);//from www .j a va2 s.c o m GL11.glColor4f((float) col.getRed() / 255f, (float) col.getGreen() / 255f, (float) col.getBlue() / 255f, (float) col.getAlpha() / 255f); GL11.glLineWidth(1.0f); GL11.glBegin(type); GL11.glVertex2f(x, y); GL11.glVertex2f(x + width, y); GL11.glVertex2f(x + width, y + height); GL11.glVertex2f(x, y + height); GL11.glEnd(); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:com.headswilllol.mineflat.gui.GuiElement.java
License:Open Source License
public void draw() { if (isActive()) { GL11.glColor4f(color.getX(), color.getY(), color.getZ(), color.getW()); GL11.glBegin(GL11.GL_QUADS);//from w ww .j a v a2s .c o m GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + size.getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + size.getX(), getAbsolutePosition().getY() + size.getY()); GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY() + size.getY()); GL11.glEnd(); for (GuiElement ge : children.values()) { ge.draw(); } } }
From source file:com.headswilllol.mineflat.gui.TextField.java
License:Open Source License
@Override public void draw() { if (isActive()) { GL11.glColor4f(bgColor.getX(), bgColor.getY(), bgColor.getZ(), bgColor.getW()); GL11.glBegin(GL11.GL_QUADS);// w w w . ja v a 2 s.c om GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + getSize().getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + getSize().getX(), getAbsolutePosition().getY() + getSize().getY()); GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY() + getSize().getY()); GL11.glEnd(); GL11.glColor4f(textColor.getX(), textColor.getY(), textColor.getZ(), textColor.getW()); GraphicsHandler.drawString(getText(), getAbsolutePosition().getX() + 3, getAbsolutePosition().getY() + 3, getSize().getY() - 6, false); if (selected == this) { GL11.glBegin(GL11.GL_QUADS); int /* I got 'em foaming from the mouth and I just hit 'em with the */ baseX = getAbsolutePosition() .getX() + GraphicsHandler.getStringLength(getText().substring(0, column + 1), getSize().getY() - 6) + 1; int baseY = getAbsolutePosition().getY() + 1; GL11.glVertex2i(baseX, baseY); GL11.glVertex2i(baseX + 2, baseY); GL11.glVertex2i(baseX + 2, baseY + getSize().getY() - 2); GL11.glVertex2i(baseX, baseY + getSize().getY() - 2); GL11.glEnd(); } } }