List of usage examples for org.lwjgl.opengl GL11 glVertex3f
public static native void glVertex3f(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:org.terasology.logic.particles.BlockParticleEmitterSystem.java
License:Apache License
private void drawParticle() { glBegin(GL_QUADS);//from w w w. j a va 2 s .c o m GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(-0.5f, 0.5f, 0.0f); GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(0.5f, 0.5f, 0.0f); GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(0.5f, -0.5f, 0.0f); GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(-0.5f, -0.5f, 0.0f); glEnd(); }
From source file:org.terasology.particles.rendering.SpriteParticleRenderer.java
License:Apache License
@Override public void initialise() { drawUnitQuad = new DisplayList(() -> { glBegin(GL_TRIANGLE_FAN);/*w w w .j av a 2 s .c o m*/ GL11.glTexCoord2f(UNIT_QUAD_VERTICES[0] + 0.5f, -UNIT_QUAD_VERTICES[1] + 0.5f); GL11.glVertex3f(UNIT_QUAD_VERTICES[0], UNIT_QUAD_VERTICES[1], UNIT_QUAD_VERTICES[2]); GL11.glTexCoord2f(UNIT_QUAD_VERTICES[3] + 0.5f, -UNIT_QUAD_VERTICES[4] + 0.5f); GL11.glVertex3f(UNIT_QUAD_VERTICES[3], UNIT_QUAD_VERTICES[4], UNIT_QUAD_VERTICES[5]); GL11.glTexCoord2f(UNIT_QUAD_VERTICES[6] + 0.5f, -UNIT_QUAD_VERTICES[7] + 0.5f); GL11.glVertex3f(UNIT_QUAD_VERTICES[6], UNIT_QUAD_VERTICES[7], UNIT_QUAD_VERTICES[8]); GL11.glTexCoord2f(UNIT_QUAD_VERTICES[9] + 0.5f, -UNIT_QUAD_VERTICES[10] + 0.5f); GL11.glVertex3f(UNIT_QUAD_VERTICES[9], UNIT_QUAD_VERTICES[10], UNIT_QUAD_VERTICES[11]); glEnd(); }); }
From source file:org.terasology.rendering.AABBRenderer.java
License:Apache License
private void generateDisplayListSolid() { displayListSolid = glGenLists(1);/* w w w .ja v a2 s.c o m*/ glNewList(displayListSolid, GL11.GL_COMPILE); glBegin(GL_QUADS); glColor4f(solidColor.x, solidColor.y, solidColor.z, solidColor.w); Vector3f dimensions = aabb.getExtents(); GL11.glVertex3f(-dimensions.x, dimensions.y, dimensions.z); GL11.glVertex3f(dimensions.x, dimensions.y, dimensions.z); GL11.glVertex3f(dimensions.x, dimensions.y, -dimensions.z); GL11.glVertex3f(-dimensions.x, dimensions.y, -dimensions.z); GL11.glVertex3f(-dimensions.x, -dimensions.y, -dimensions.z); GL11.glVertex3f(-dimensions.x, -dimensions.y, dimensions.z); GL11.glVertex3f(-dimensions.x, dimensions.y, dimensions.z); GL11.glVertex3f(-dimensions.x, dimensions.y, -dimensions.z); GL11.glVertex3f(-dimensions.x, -dimensions.y, dimensions.z); GL11.glVertex3f(dimensions.x, -dimensions.y, dimensions.z); GL11.glVertex3f(dimensions.x, dimensions.y, dimensions.z); GL11.glVertex3f(-dimensions.x, dimensions.y, dimensions.z); GL11.glVertex3f(dimensions.x, dimensions.y, -dimensions.z); GL11.glVertex3f(dimensions.x, dimensions.y, dimensions.z); GL11.glVertex3f(dimensions.x, -dimensions.y, dimensions.z); GL11.glVertex3f(dimensions.x, -dimensions.y, -dimensions.z); GL11.glVertex3f(-dimensions.x, dimensions.y, -dimensions.z); GL11.glVertex3f(dimensions.x, dimensions.y, -dimensions.z); GL11.glVertex3f(dimensions.x, -dimensions.y, -dimensions.z); GL11.glVertex3f(-dimensions.x, -dimensions.y, -dimensions.z); GL11.glVertex3f(-dimensions.x, -dimensions.y, -dimensions.z); GL11.glVertex3f(dimensions.x, -dimensions.y, -dimensions.z); GL11.glVertex3f(dimensions.x, -dimensions.y, dimensions.z); GL11.glVertex3f(-dimensions.x, -dimensions.y, dimensions.z); glEnd(); glEndList(); }
From source file:org.terasology.rendering.gui.components.UIPieChart.java
License:Apache License
public void render() { super.render(); if (_data.size() == 0) return;/*w ww .j a va 2s.co m*/ ArrayList<String> sortedKeys = new ArrayList<String>(_data.keySet()); Collections.sort(sortedKeys); glPushMatrix(); glTranslatef(getSize().x / 2, getSize().y / 2, 0.0f); GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glVertex3f(0f, 0f, 0f); double stepSize = (Math.PI * 2.0) / SEGMENTS; int segment = 0; double prevValueSum = 0.0f; for (int i = 0; i <= SEGMENTS; i++) { double value = _data.get(sortedKeys.get(segment)); if (((double) i / SEGMENTS) >= value + prevValueSum) { segment++; prevValueSum += value; Vector3f segmentColor = new Vector3f((segment * 0.1f) % 1.0f, (segment * 0.2f) % 1.0f, (segment * 0.4f) % 1.0f); glColor3f(segmentColor.x, segmentColor.y, segmentColor.z); } GL11.glVertex2f((float) Math.sin(stepSize * i) * (getSize().x / 2), (float) Math.cos(stepSize * i) * (getSize().x / 2)); } GL11.glEnd(); glPopMatrix(); }
From source file:org.terasology.rendering.particles.BlockParticle.java
License:Apache License
private void drawParticle() { Block b = BlockManager.getInstance().getBlock(_blockType); glBegin(GL_QUADS);/*from www . j a v a 2 s . co m*/ GL11.glTexCoord2f(b.calcTextureOffsetFor(Block.SIDE.FRONT).x, b.calcTextureOffsetFor(Block.SIDE.FRONT).y); GL11.glVertex3f(-0.5f, -0.5f, 0.0f); GL11.glTexCoord2f(b.calcTextureOffsetFor(Block.SIDE.FRONT).x + TEX_SIZE, b.calcTextureOffsetFor(Block.SIDE.FRONT).y); GL11.glVertex3f(0.5f, -0.5f, 0.0f); GL11.glTexCoord2f(b.calcTextureOffsetFor(Block.SIDE.FRONT).x + TEX_SIZE, b.calcTextureOffsetFor(Block.SIDE.FRONT).y + TEX_SIZE); GL11.glVertex3f(0.5f, 0.5f, 0.0f); GL11.glTexCoord2f(b.calcTextureOffsetFor(Block.SIDE.FRONT).x, b.calcTextureOffsetFor(Block.SIDE.FRONT).y + TEX_SIZE); GL11.glVertex3f(-0.5f, 0.5f, 0.0f); glEnd(); }
From source file:org.voxels.platform.LWJGLOpenGLAdapter.java
License:Open Source License
@Override public void glVertex3f(final float x, final float y, final float z) { GL11.glVertex3f(x, y, z); }
From source file:physics.BoxShell.java
License:Open Source License
public void draw() { float len = length / 2; GL11.glBegin(GL11.GL_QUADS);// w ww . java 2 s . com GL11.glVertex3f(-len, -len, height); GL11.glVertex3f(len, -len, height); GL11.glVertex3f(len, len, height); GL11.glVertex3f(-len, len, height); GL11.glVertex3f(-len, -len, 0); GL11.glVertex3f(len, -len, 0); GL11.glVertex3f(len, len, 0); GL11.glVertex3f(-len, len, 0); GL11.glEnd(); }
From source file:robot.animation.Robot.java
private void drawCircle(double r, int n) { double theta = 2 * Math.PI / n; GL11.glPushMatrix();/*from ww w. j a va 2s. c om*/ GL11.glBegin(GL11.GL_LINES); for (int i = 0; i < n;) { float x = (float) (r * Math.cos(theta * i)); float y = (float) (r * Math.sin(theta * i)); GL11.glVertex3f(x, y, 0); i++; x = (float) (r * Math.cos(theta * i)); y = (float) (r * Math.sin(theta * i)); GL11.glVertex3f(x, y, 0); } GL11.glEnd(); GL11.glPopMatrix(); }
From source file:robot.animation.Robot.java
private void drawRectangle(double width, double height) { GL11.glPushMatrix();//from ww w. j av a 2 s . c om GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3f((float) width / 2, (float) height / 2, 0); GL11.glVertex3f(-(float) width / 2, (float) height / 2, 0); GL11.glVertex3f(-(float) width / 2, -(float) height / 2, 0); GL11.glVertex3f((float) width / 2, -(float) height / 2, 0); GL11.glEnd(); GL11.glPopMatrix(); }
From source file:robot.animation.Robot.java
private void drawHead() { GL11.glPushMatrix();//from w w w . j a v a2s.c om GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3f(0f, headRadius * 0.1f, 0); GL11.glVertex3f(-headRadius * 0.1f, -headRadius * 0.3f, 0); GL11.glVertex3f(+headRadius * 0.1f, -headRadius * 0.3f, 0); GL11.glEnd(); GL11.glTranslatef(headRadius * 0.35f, headRadius * 0.1f, 0f); drawCircle(headRadius * 0.2f, headSegments); GL11.glTranslatef(-headRadius * 0.7f, 0f, 0f); drawCircle(headRadius * 0.2f, headSegments); GL11.glPopMatrix(); drawCircle(headRadius, headSegments); }