List of usage examples for org.lwjgl.opengl GL11 glVertex3d
public static native void glVertex3d(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:fi.conf.ae.gl.text.GLBitmapFontBlitter.java
License:LGPL
public static void drawString(String string, String textureIdentifier, float charWidth, float charHeight, Alignment align) {/*from www . j a va 2s . c om*/ float hOverlap = 0.01f; float vOverlap = 0.0f; float xfix = 0; if (align.equals(Alignment.CENTERED)) { xfix = string.length() * charWidth * 0.5f; } else if (align.equals(Alignment.RIGHT)) { xfix = string.length() * charWidth - hOverlap; } GL11.glPushMatrix(); GL11.glTranslatef(0, -0.5f * charHeight, 0); GLTextureManager.getInstance().bindTexture(textureIdentifier); GL11.glBegin(GL11.GL_QUADS); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); float x1 = (c % 16f) / 16f; float x2 = x1 + 1f / 16f; float y1 = (c / 16) / 16f; float y2 = y1 + 1f / 16f; GL11.glTexCoord2d(x1 + hOverlap, y1 + vOverlap); GL11.glVertex3d(i * charWidth - xfix, 0, 0); GL11.glTexCoord2d(x1 + hOverlap, y2 - vOverlap); GL11.glVertex3d(i * charWidth - xfix, charHeight, 0); GL11.glTexCoord2d(x2 - hOverlap, y2 - vOverlap); GL11.glVertex3d(i * charWidth + charWidth - xfix, charHeight, 0); GL11.glTexCoord2d(x2 - hOverlap, y1 + vOverlap); GL11.glVertex3d(i * charWidth + charWidth - xfix, 0, 0); } GL11.glEnd(); GL11.glPopMatrix(); }
From source file:fi.conf.ae.gl.text.GLBitmapFontBlitter.java
License:LGPL
public static void drawScrollerString(String string, float charWidth, float charHeight, float freq, float amplitude, float phase, String font) { float overlap = 0.2f; float fix = 0; GL11.glPushMatrix();/*from ww w .j a v a2 s. c o m*/ GLTextureManager.getInstance().bindTexture(font); //GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID); GL11.glEnable(GL11.GL_DEPTH_TEST); //GLRoutines.drawSprite(0f, 0f, 2f, 2f, 1f); GL11.glBegin(GL11.GL_QUADS); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); float s = (float) Math.sin(phase + freq * 2 * Math.PI * i / string.length()) * amplitude; float x1 = (c % 16f) / 16f; float x2 = (c % 16f) / 16f + 1f / 16f; float y1 = (c / 16) / 16f; float y2 = (c / 16) / 16f + 1f / 16f; //drawSprite(x1, y1, x2, y2, 0); //GL11.glColor3f((float)Math.random()*1.3f, (float)Math.random()*1.3f, (float)Math.random()*1.3f); GL11.glTexCoord2d(x1, y1); GL11.glVertex3d(i * charWidth - fix - overlap, s, 0); GL11.glTexCoord2d(x1, y2); GL11.glVertex3d(i * charWidth - fix - overlap, charHeight + s, 0); GL11.glTexCoord2d(x2, y2); GL11.glVertex3d(i * charWidth + charWidth - fix, charHeight + s, 0); GL11.glTexCoord2d(x2, y1); GL11.glVertex3d(i * charWidth + charWidth - fix, s, 0); } GL11.glEnd(); GL11.glPopMatrix(); }
From source file:fi.conf.ae.gl.text.GLBitmapFontBlitter.java
License:LGPL
public static void drawCircleString(String string, float charHeight, float freq, float radius, float phase, String font) {// www .j av a 2 s .c om GL11.glPushMatrix(); GLTextureManager.getInstance().bindTexture(font); //GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID); GL11.glEnable(GL11.GL_DEPTH_TEST); //GLRoutines.drawSprite(0f, 0f, 2f, 2f, 1f); //GL11.glTranslatef(charWidth/2, -charHeight/2, 0); for (int i = 0; i < string.length(); i++) { char c = string.charAt(string.length() - 1 - i); float vx1 = (float) Math.sin(phase + freq * 2 * Math.PI * i / string.length()) * radius; float vy1 = (float) Math.cos(phase + freq * 2 * Math.PI * i / string.length()) * radius; float vx2 = (float) Math.sin(phase + freq * 2 * Math.PI * i / string.length()) * radius * charHeight; float vy2 = (float) Math.cos(phase + freq * 2 * Math.PI * i / string.length()) * radius * charHeight; float vx3 = (float) Math.sin(phase + freq * 2 * Math.PI * (i + 1) / string.length()) * radius; float vy3 = (float) Math.cos(phase + freq * 2 * Math.PI * (i + 1) / string.length()) * radius; float vx4 = (float) Math.sin(phase + freq * 2 * Math.PI * (i + 1) / string.length()) * radius * charHeight; float vy4 = (float) Math.cos(phase + freq * 2 * Math.PI * (i + 1) / string.length()) * radius * charHeight; float x1 = (c % 16f) / 16f; float x2 = (c % 16f) / 16f + 1f / 16f; float y1 = (c / 16) / 16f; float y2 = (c / 16) / 16f + 1f / 16f; //GL11.glColor3f((float)Math.random()*1.3f, (float)Math.random()*1.3f, (float)Math.random()*1.3f); //GL11.glBindTexture(GL11.GL_TEXTURE_2D, -1); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2d(x1, y1); GL11.glVertex3d(vy4, vx4, 0); GL11.glTexCoord2d(x1, y2); GL11.glVertex3d(vy3, vx3, 0); GL11.glTexCoord2d(x2, y2); GL11.glVertex3d(vy1, vx1, 0); GL11.glTexCoord2d(x2, y1); GL11.glVertex3d(vy2, vx2, 0); GL11.glEnd(); } GL11.glPopMatrix(); }
From source file:fi.conf.prograts.ar.gl.GLBitmapFontBlitter.java
License:LGPL
public static void drawString(String string, String textureIdentifier, float charWidth, float charHeight, Alignment align) {//from w w w . j av a 2 s. c om float fix = 0; float overlap = 0.01f; if (align.equals(Alignment.CENTERED)) { fix = string.length() * charWidth * 0.5f; } else if (align.equals(Alignment.RIGHT)) { fix = string.length() * charWidth - overlap; } GL11.glPushMatrix(); GL11.glTranslatef(0, -0.5f * charHeight, 0); // System.out.println(textureID); GLTextureManager.getInstance().bindTexture(textureIdentifier); GL11.glBegin(GL11.GL_QUADS); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); float x1 = (c % 16f) / 16f; float x2 = x1 + 1f / 16f; float y1 = (c / 16) / 16f; float y2 = y1 + 1f / 16f; GL11.glTexCoord2d(x1 + overlap, y1); GL11.glVertex3d(i * charWidth - fix, 0, 0); GL11.glTexCoord2d(x1 + overlap, y2); GL11.glVertex3d(i * charWidth - fix, charHeight, 0); GL11.glTexCoord2d(x2 - overlap, y2); GL11.glVertex3d(i * charWidth + charWidth - fix, charHeight, 0); GL11.glTexCoord2d(x2 - overlap, y1); GL11.glVertex3d(i * charWidth + charWidth - fix, 0, 0); } GL11.glEnd(); GL11.glPopMatrix(); }
From source file:fi.conf.prograts.ar.gl.GLBitmapFontBlitter.java
License:LGPL
public static void blitScrollerString(String string, float charWidth, float charHeight, float freq, float amplitude, float phase, String font) { float overlap = 0.2f; float fix = 0; GL11.glPushMatrix();/*from w w w. j a va 2s . c o m*/ GLTextureManager.getInstance().bindTexture(font); //GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID); GL11.glEnable(GL11.GL_DEPTH_TEST); //GLRoutines.drawSprite(0f, 0f, 2f, 2f, 1f); GL11.glBegin(GL11.GL_QUADS); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); float s = (float) Math.sin(phase + freq * 2 * Math.PI * i / string.length()) * amplitude; float x1 = (c % 16f) / 16f; float x2 = (c % 16f) / 16f + 1f / 16f; float y1 = (c / 16) / 16f; float y2 = (c / 16) / 16f + 1f / 16f; //drawSprite(x1, y1, x2, y2, 0); //GL11.glColor3f((float)Math.random()*1.3f, (float)Math.random()*1.3f, (float)Math.random()*1.3f); GL11.glTexCoord2d(x1, y1); GL11.glVertex3d(i * charWidth - fix - overlap, s, 0); GL11.glTexCoord2d(x1, y2); GL11.glVertex3d(i * charWidth - fix - overlap, charHeight + s, 0); GL11.glTexCoord2d(x2, y2); GL11.glVertex3d(i * charWidth + charWidth - fix, charHeight + s, 0); GL11.glTexCoord2d(x2, y1); GL11.glVertex3d(i * charWidth + charWidth - fix, s, 0); } GL11.glEnd(); GL11.glPopMatrix(); }
From source file:fi.conf.prograts.ar.gl.GLBitmapFontBlitter.java
License:LGPL
public static void blitSinString(String string, float charWidth, float charHeight, float freq, float amplitude, float phase, String font) { float overlap = 0.2f; float fix = 0; GL11.glPushMatrix();/*from w w w . j av a 2 s . com*/ GLTextureManager.getInstance().bindTexture(font); //GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID); GL11.glEnable(GL11.GL_DEPTH_TEST); //GLRoutines.drawSprite(0f, 0f, 2f, 2f, 1f); //GL11.glTranslatef(charWidth/2, -charHeight/2, 0); for (int i = 0; i < string.length(); i++) { char c = string.charAt(string.length() - 1 - i); float vx1 = (float) Math.sin(phase + freq * 2 * Math.PI * i / string.length()) * amplitude; float vy1 = (float) Math.cos(phase + freq * 2 * Math.PI * i / string.length()) * amplitude; float vx2 = (float) Math.sin(phase + freq * 2 * Math.PI * i / string.length()) * amplitude * charHeight; float vy2 = (float) Math.cos(phase + freq * 2 * Math.PI * i / string.length()) * amplitude * charHeight; float vx3 = (float) Math.sin(phase + freq * 2 * Math.PI * (i + 1) / string.length()) * amplitude; float vy3 = (float) Math.cos(phase + freq * 2 * Math.PI * (i + 1) / string.length()) * amplitude; float vx4 = (float) Math.sin(phase + freq * 2 * Math.PI * (i + 1) / string.length()) * amplitude * charHeight; float vy4 = (float) Math.cos(phase + freq * 2 * Math.PI * (i + 1) / string.length()) * amplitude * charHeight; float x1 = (c % 16f) / 16f; float x2 = (c % 16f) / 16f + 1f / 16f; float y1 = (c / 16) / 16f; float y2 = (c / 16) / 16f + 1f / 16f; //GL11.glColor3f((float)Math.random()*1.3f, (float)Math.random()*1.3f, (float)Math.random()*1.3f); //GL11.glBindTexture(GL11.GL_TEXTURE_2D, -1); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2d(x1, y1); GL11.glVertex3d(vy4, vx4, 0); GL11.glTexCoord2d(x1, y2); GL11.glVertex3d(vy3, vx3, 0); GL11.glTexCoord2d(x2, y2); GL11.glVertex3d(vy1, vx1, 0); GL11.glTexCoord2d(x2, y1); GL11.glVertex3d(vy2, vx2, 0); GL11.glEnd(); } GL11.glPopMatrix(); }
From source file:fr.def.iss.vd2.lib_v3d.camera.V3DSimple2DCamera.java
License:Open Source License
private void displayTarget() { GL11.glColor4f(1.0f, 0.5f, 0.5f, 0.8f); GL11.glLineWidth(1.2f);//w ww . jav a 2s . c o m GL11.glBegin(GL11.GL_LINES); { GL11.glColor4f(1.0f, 0.0f, 0.0f, 0.8f); GL11.glVertex3d(-1, 0, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, 0.1, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, -0.1, 0); GL11.glVertex3d(1, 0, 0); //y GL11.glColor4f(0.0f, 1.0f, 0.0f, 0.8f); GL11.glVertex3d(0, -1, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(-0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); //z GL11.glColor4f(0.0f, 0.0f, 1.0f, 0.8f); GL11.glVertex3d(0, 0, -1); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(-0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); } GL11.glEnd(); GL11.glPointSize(1.2f); GL11.glBegin(GL11.GL_POINTS); { GL11.glVertex3d(position.x, position.y, 0); } GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.camera.V3DSimple3DCamera.java
License:Open Source License
private void displayTarget() { GL11.glColor4f(1.0f, 0.5f, 0.5f, 0.8f); GL11.glLineWidth(1.2f);/*from w w w .j a v a 2s . c o m*/ GL11.glBegin(GL11.GL_LINES); { GL11.glColor4f(1.0f, 0.0f, 0.0f, 0.8f); GL11.glVertex3d(-1, 0, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, 0.1, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, -0.1, 0); GL11.glVertex3d(1, 0, 0); //y GL11.glColor4f(0.0f, 1.0f, 0.0f, 0.8f); GL11.glVertex3d(0, -1, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(-0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); //z GL11.glColor4f(0.0f, 0.0f, 1.0f, 0.8f); GL11.glVertex3d(0, 0, -1); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(-0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); } GL11.glEnd(); GL11.glPointSize(1.2f); GL11.glBegin(GL11.GL_POINTS); { GL11.glVertex3d(position.x, position.y, position.z); } GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DBoundingBox.java
License:Open Source License
public void display() { if (showCenter) { GL11.glColor4f(centerColor.r, centerColor.g, centerColor.b, centerColor.a); GL11.glPointSize(4.0f);// w w w . j a va 2s .co m GL11.glBegin(GL11.GL_POINTS); GL11.glVertex3d(center.x, center.y, center.z); GL11.glEnd(); } if (flat || size.z == 0) { displayFlat(); } else { displayThick(); } }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DBoundingBox.java
License:Open Source License
public void displayFlatLines() { float x0 = position.x - size.x / 2; float y0 = position.y - size.y / 2; float x1 = position.x + size.x / 2; float y1 = position.y + size.y / 2; GL11.glColor4f(lineColor.r, lineColor.g, lineColor.b, lineColor.a); GL11.glLineWidth(2.0f);//w w w . java 2 s. c o m GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3d(x0, y1, 0); GL11.glVertex3d(x0, y0, 0); GL11.glVertex3d(x1, y0, 0); GL11.glVertex3d(x1, y1, 0); GL11.glEnd(); }