List of usage examples for org.lwjgl.opengl GL11 glVertex2d
public static native void glVertex2d(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y);
From source file:org.cogaen.lwjgl.scene.RectangleVisual.java
License:Open Source License
@Override public void render() { getColor().apply();// w ww . jav a 2 s . c om GL11.glBegin(this.glMode); GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * getScale()); GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * getScale()); GL11.glVertex2d(this.halfWidth * getScale(), this.halfHeight * getScale()); GL11.glVertex2d(-this.halfWidth * getScale(), this.halfHeight * getScale()); GL11.glEnd(); }
From source file:org.cogaen.lwjgl.scene.SpriteFxVisual.java
License:Open Source License
@Override public void render() { if (this.flipVertical) { GL11.glScaled(1, -1, 1);//from w w w. jav a 2 s.c o m } if (this.shadow) { double dx = this.halfWidth * getScale() * 0.02; double dy = this.halfWidth * getScale() * 0.02; GL11.glColor4d(getColor().getRed() * 0.1, getColor().getGreen() * 0.1, getColor().getBlue() * 0.1, 0.7); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0.0f, this.texture.getHeight()); GL11.glVertex2d(-this.halfWidth * getScale() + dx, -this.halfHeight * getScale() - dy); GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight()); GL11.glVertex2d(this.halfWidth * getScale() + dx, -this.halfHeight * getScale() - dy); GL11.glTexCoord2f(this.texture.getWidth(), 0); GL11.glVertex2d(this.halfWidth * getScale() + dx, this.halfHeight * getScale() - dy); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex2d(-this.halfWidth * getScale() + dx, this.halfHeight * getScale() - dy); } getColor().apply(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0.0f, this.texture.getHeight()); GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * getScale()); GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight()); GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * getScale()); GL11.glTexCoord2f(this.texture.getWidth(), 0); GL11.glVertex2d(this.halfWidth * getScale(), this.halfHeight * getScale()); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex2d(-this.halfWidth * getScale(), this.halfHeight * getScale()); if (this.mirror) { GL11.glColor4d(getColor().getRed() * 0.7, getColor().getGreen() * 0.7, getColor().getBlue() * 0.7, 0.7); GL11.glTexCoord2f(0.0f, this.texture.getHeight()); GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * getScale()); GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight()); GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * getScale()); GL11.glColor4d(getColor().getRed(), getColor().getGreen(), getColor().getBlue(), 0); GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight() / 2); GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * 2 * getScale()); GL11.glTexCoord2f(0.0f, this.texture.getHeight() / 2); GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * 2 * getScale()); } GL11.glEnd(); }
From source file:org.cogaen.lwjgl.scene.SpriteVisual.java
License:Open Source License
@Override public void render() { getColor().apply();/*from w w w . ja va 2 s .c o m*/ if (this.flipVertical) { GL11.glScaled(1, -1, 1); } GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0.0f, this.texture.getHeight()); GL11.glVertex2d(-this.halfWidth * getScale(), -this.halfHeight * getScale()); GL11.glTexCoord2f(this.texture.getWidth(), this.texture.getHeight()); GL11.glVertex2d(this.halfWidth * getScale(), -this.halfHeight * getScale()); GL11.glTexCoord2f(this.texture.getWidth(), 0); GL11.glVertex2d(this.halfWidth * getScale(), this.halfHeight * getScale()); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex2d(-this.halfWidth * getScale(), this.halfHeight * getScale()); GL11.glEnd(); }
From source file:org.cogaen.lwjgl.scene.TextBlockVisual.java
License:Open Source License
@Override public void render() { GL11.glPushMatrix();//from ww w . ja va 2 s.co m GL11.glScaled(getScale(), -getScale(), 1); getColor().apply(); org.newdawn.slick.Color utilColor = new org.newdawn.slick.Color((int) (getColor().getRed() * 255), (int) (getColor().getGreen() * 255), (int) (getColor().getBlue() * 255), (int) (getColor().getAlpha() * 255)); if (this.timeStamp < this.timer.getTime()) { this.timeStamp = this.timer.getTime() + BLINK_TIME; this.cursorOn = !this.cursorOn; } for (int i = 0; i < this.lines.length; ++i) { this.ttf.drawString((float) (-this.width / 2), (float) (-this.height / 2 + i * ttf.getHeight() * LINE_SPACE), this.lines[i].toString(), utilColor); } if (this.cursorOn && this.showCursor) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); double offsetX; if (this.curX == 0) { offsetX = 0; } else if (this.curX >= this.lines[this.curY].length()) { offsetX = this.ttf.getWidth(this.lines[this.curY].substring(0, this.lines[this.curY].length())); } else { offsetX = this.ttf.getWidth(this.lines[this.curY].substring(0, this.curX)); } double offsetY = this.curY * this.ttf.getHeight() * LINE_SPACE; double x = -this.width / 2 + offsetX; double y = -this.height / 2 + offsetY + this.ttf.getHeight() / 2; double curHeight = this.ttf.getHeight() / 2 * 0.8; GL11.glBegin(GL11.GL_LINES); GL11.glVertex2d(x, y + curHeight); GL11.glVertex2d(x, y - curHeight); GL11.glEnd(); } GL11.glPopMatrix(); }
From source file:render.Render.java
License:Open Source License
public void drawSquare(Point min, Point max) { GL11.glBegin(GL11.GL_POLYGON);/*w w w .j av a2 s . c o m*/ GL11.glVertex2d(min.getX(), min.getY()); GL11.glVertex2d(min.getX(), max.getY()); GL11.glVertex2d(max.getX(), max.getY()); GL11.glVertex2d(max.getX(), min.getY()); GL11.glEnd(); }
From source file:render.Render.java
License:Open Source License
public void drawLines(ArrayList<Point> positions) { //GL11.glColor3d(0,245,51); GL11.glBegin(GL11.GL_LINE_STRIP);/* www .j a v a2 s . co m*/ for (Point position : positions) { //FasT.getFasT().getLogger().error(position.getX()); GL11.glVertex2d(position.getX(), position.getY()); } GL11.glEnd(); }
From source file:render.Render.java
License:Open Source License
private void drawCircle(Point center, double radius, int num_segments, float[] color) { GL11.glColor3d(color[0], color[1], color[2]); GL11.glBegin(GL11.GL_POLYGON);/*from ww w . j a v a 2 s . c o m*/ for (int ii = 0; ii < num_segments; ii++) { float theta = 2.0f * 3.1415926f * ii / num_segments;//get the current angle float x = (float) (radius * Math.cos(theta));//calculate the x component float y = (float) (radius * Math.sin(theta));//calculate the y component GL11.glVertex2d(x + center.getX(), y + center.getY());//output vertex } GL11.glEnd(); }
From source file:render.Render.java
License:Open Source License
public void drawCorners(Point pos, double radius, float[] color) { GL11.glColor3d(color[0], color[1], color[2]); double d = radius / 2; GL11.glBegin(GL11.GL_LINE_STRIP);/*from w ww . ja va 2 s . c o m*/ GL11.glVertex2d(pos.getX() - radius, pos.getY() + d); GL11.glVertex2d(pos.getX() - radius, pos.getY() + radius); GL11.glVertex2d(pos.getX() - d, pos.getY() + radius); GL11.glEnd(); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2d(pos.getX() + radius, pos.getY() - d); GL11.glVertex2d(pos.getX() + radius, pos.getY() - radius); GL11.glVertex2d(pos.getX() + d, pos.getY() - radius); GL11.glEnd(); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2d(pos.getX() - radius, pos.getY() - d); GL11.glVertex2d(pos.getX() - radius, pos.getY() - radius); GL11.glVertex2d(pos.getX() - d, pos.getY() - radius); GL11.glEnd(); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex2d(pos.getX() + radius, pos.getY() + d); GL11.glVertex2d(pos.getX() + radius, pos.getY() + radius); GL11.glVertex2d(pos.getX() + d, pos.getY() + radius); GL11.glEnd(); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glVertex2d(double a, double b) { GL11.glVertex2d(a, b); }
From source file:tk.wurst_client.alts.gui.AltEditorScreen.java
License:Open Source License
/** * Draws the screen and all the components in it. *//*from w ww . j a va2 s . c o m*/ @Override public void drawScreen(int par1, int par2, float par3) { drawDefaultBackground(); AltRenderer.drawAltBack(getName(), (width / 2 - 100) / 2 - 64, height / 2 - 128, 128, 256); AltRenderer.drawAltBody(getName(), width - (width / 2 - 100) / 2 - 64, height / 2 - 128, 128, 256); drawCenteredString(fontRendererObj, getTitle(), width / 2, 20, 16777215); drawString(fontRendererObj, "Name or E-Mail", width / 2 - 100, 47, 10526880); drawString(fontRendererObj, "Password", width / 2 - 100, 87, 10526880); drawString(fontRendererObj, "Name: " + getName(), width / 2 - 100, 127, 10526880); drawCenteredString(fontRendererObj, displayText, width / 2, 142, 16777215); emailBox.drawTextBox(); passwordBox.drawTextBox(); if (errorTimer > 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL_CULL_FACE); GL11.glEnable(GL_BLEND); GL11.glColor4f(1.0F, 0.0F, 0.0F, (float) errorTimer / 16); GL11.glBegin(GL11.GL_QUADS); { GL11.glVertex2d(0, 0); GL11.glVertex2d(width, 0); GL11.glVertex2d(width, height); GL11.glVertex2d(0, height); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL_CULL_FACE); GL11.glDisable(GL_BLEND); errorTimer--; } super.drawScreen(par1, par2, par3); }