List of usage examples for org.lwjgl.opengl GL11 glEnd
public static native void glEnd();
From source file:DrawShapes.java
public static void fillRectangle(float x, float y, float width, float height) { GL11.glBegin(GL11.GL_QUADS);//from www . j a va 2 s . c om GL11.glVertex3f(x, y, 0); GL11.glVertex3f(x + width, y, 0); GL11.glVertex3f(x + width, y + height, 0); GL11.glVertex3f(x, y + height, 0); GL11.glEnd(); }
From source file:DrawShapes.java
public static void strokeRectangle(float x, float y, float width, float height) { GL11.glBegin(GL11.GL_LINE_LOOP);//from w w w. j a va 2s. c om GL11.glVertex3f(x, y, 0); GL11.glVertex3f(x + width, y, 0); GL11.glVertex3f(x + width, y + height, 0); GL11.glVertex3f(x, y + height, 0); GL11.glEnd(); }
From source file:DrawShapes.java
public static void strokeCircle(float radius, int sides) { float dtheta = (float) Math.PI * 2 / sides; GL11.glBegin(GL11.GL_LINES);// ww w. j a va2 s. c o m for (int i = 0; i < sides; i++) { float x0, y0; float x1, y1; x0 = radius * (float) Math.cos(i * dtheta); y0 = radius * (float) Math.sin(i * dtheta); x1 = radius * (float) Math.cos((i + 1) * dtheta); y1 = radius * (float) Math.sin((i + 1) * dtheta); GL11.glVertex3f(x0, y0, 0); GL11.glVertex3f(x1, y1, 0); } GL11.glEnd(); }
From source file:DrawShapes.java
public static void fillCircle(float radius, int sides) { float dtheta = (float) Math.PI * 2 / sides; GL11.glBegin(GL11.GL_TRIANGLES);//from w w w.j a v a 2 s .c om for (int i = 0; i < sides; i++) { float x0, y0; float x1, y1; x0 = radius * (float) Math.cos(i * dtheta); y0 = radius * (float) Math.sin(i * dtheta); x1 = radius * (float) Math.cos((i + 1) * dtheta); y1 = radius * (float) Math.sin((i + 1) * dtheta); GL11.glVertex3f(0, 0, 0); GL11.glVertex3f(x0, y0, 0); GL11.glVertex3f(x1, y1, 0); } GL11.glEnd(); }
From source file:$.DrawSystem.java
License:Open Source License
private void drawLevel(Level level) { GL11.glPushMatrix();/*from w w w .j av a 2 s. co m*/ GL11.glLoadIdentity(); IPlay backgroundAnimationPlay = level.getBackground(); backgroundAnimationPlay.update((long) (world.getDelta() * 1000L)); final IAnimationFrame currentFrame = backgroundAnimationPlay.getCurrentFrame(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, (Integer) currentFrame.getImage().getId()); float x1 = -toolkit.getVirtualResolutionWidth() / 2.0f; float x2 = toolkit.getVirtualResolutionWidth() / 2.0f; float y1 = toolkit.getVirtualResolutionHeight() / 2.0f; float y2 = -toolkit.getVirtualResolutionHeight() / 2.0f; float u1 = currentFrame.getU1(); float u2 = currentFrame.getU2(); float v1 = currentFrame.getV2(); float v2 = currentFrame.getV1(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(u1, v1); GL11.glVertex2f(x1, y2); GL11.glTexCoord2f(u2, v1); GL11.glVertex2f(x2, y2); GL11.glTexCoord2f(u2, v2); GL11.glVertex2f(x2, y1); GL11.glTexCoord2f(u1, v2); GL11.glVertex2f(x1, y1); GL11.glEnd(); GL11.glPopMatrix(); }
From source file:$.DrawSystem.java
License:Open Source License
private void drawSprite(Sprite sprite) { Vector pos = spriteProjector.project(sprite.getPosition()); final IPlay play = sprite.getPlay(); if (null != play) { GL11.glPushMatrix();//from w w w . ja v a 2 s . c o m GL11.glTranslatef(pos.x, pos.y, 0.0f); GL11.glRotatef(sprite.getRotate(), 0, 0, 1.0f); GL11.glScalef(sprite.getScale(), sprite.getScale(), 1); final IAnimationFrame frame = play.getCurrentFrame(); final IAnimationImage image = frame.getImage(); if (image.hasAlpha()) { GL11.glEnable(GL11.GL_BLEND); } GL11.glBindTexture(GL11.GL_TEXTURE_2D, (Integer) image.getId()); final float u1, u2; if (sprite.isMirrorX()) { u1 = frame.getU2(); u2 = frame.getU1(); } else { u1 = frame.getU1(); u2 = frame.getU2(); } final float v1, v2; if (sprite.isMirrorY()) { v1 = frame.getV1(); v2 = frame.getV2(); } else { v1 = frame.getV2(); v2 = frame.getV1(); } GL11.glColor4f(sprite.getRed(), sprite.getGreen(), sprite.getBlue(), sprite.getAlpha()); float x1 = -sprite.getWidth() / 2.0f; float x2 = sprite.getWidth() / 2.0f; float y1 = -sprite.getHeight() / 2.0f; float y2 = sprite.getHeight() / 2.0f; GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(u1, v1); GL11.glVertex2f(x1, y2); GL11.glTexCoord2f(u2, v1); GL11.glVertex2f(x2, y2); GL11.glTexCoord2f(u2, v2); GL11.glVertex2f(x2, y1); GL11.glTexCoord2f(u1, v2); GL11.glVertex2f(x1, y1); GL11.glEnd(); GL11.glColor3f(1f, 1f, 1f); if (image.hasAlpha()) { GL11.glDisable(GL11.GL_BLEND); } GL11.glPopMatrix(); } if (null != sprite.getLabel()) { GL11.glPushMatrix(); GL11.glTranslatef(pos.x, pos.y, 0.0f); GL11.glScalef(0.5f, -0.5f, 1f); GL11.glEnable(GL11.GL_BLEND); LwjglNuitFont font = (LwjglNuitFont) assets.getFont(""); font.drawString(sprite.getLabel(), LwjglNuitFont.Align.CENTER); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } }
From source file:a1.gui.GUI_Map.java
License:Open Source License
public void RenderLightMap() { GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_SRC_COLOR); //Log.info("lightmap: "+LightMap); GL11.glBindTexture(GL11.GL_TEXTURE_2D, LightMap); //Resource.textures.get("core_skin").getTextureID()); GL11.glTranslatef(0, 0, 0);/*from ww w .j a va2s .co m*/ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); float texwidth = 1024; float texheight = 1024; float newTextureOffsetX = 0 / texwidth; float newTextureOffsetY = 0 / texheight; float newTextureWidth = 1024 / texwidth; float newTextureHeight = 1024 / texheight; int w = 1024; int h = 1024; GL11.glBegin(GL11.GL_QUADS); { glTexCoord2f(newTextureOffsetX, newTextureOffsetY); glVertex2i(0, 0); glTexCoord2f(newTextureOffsetX, newTextureOffsetY + newTextureHeight); glVertex2i(0, h); glTexCoord2f(newTextureOffsetX + newTextureWidth, newTextureOffsetY + newTextureHeight); glVertex2i(w, h); glTexCoord2f(newTextureOffsetX + newTextureWidth, newTextureOffsetY); glVertex2i(w, 0); } GL11.glEnd(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); }
From source file:a1.Render2D.java
License:Open Source License
static public void Line(Coord c1, Coord c2, float w) { GL11.glLineWidth(w);/*from w w w . j a v a 2s. c o m*/ GL11.glBegin(GL11.GL_LINES); GLColor(); Vertex(c1); Vertex(c2); GL11.glEnd(); CheckError(); }
From source file:a1.Render2D.java
License:Open Source License
static public void FillRect(Coord c, Coord sz) { GLColor();/*from w w w . j a v a 2 s . c om*/ GL11.glBegin(GL11.GL_QUADS); Vertex(c); Vertex(c.add(new Coord(sz.x, 0))); Vertex(c.add(sz)); Vertex(c.add(new Coord(0, sz.y))); GL11.glEnd(); CheckError(); }
From source file:a1.Render2D.java
License:Open Source License
static public void FillRect(Coord c1, Coord c2, Coord c3, Coord c4) { GLColor();//from w w w. ja v a 2 s . c o m GL11.glBegin(GL11.GL_QUADS); Vertex(c1); Vertex(c2); Vertex(c3); Vertex(c4); GL11.glEnd(); CheckError(); }