List of usage examples for org.lwjgl.opengl GL11 glBegin
public static native void glBegin(@NativeType("GLenum") int mode);
From source file:eu.over9000.veya.gui.TrueTypeFont.java
License:Open Source License
public void drawString(final float x, final float y, final String whatchars, final Color color, final int startIndex, final int endIndex) { GL11.glColor4f(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()); GL11.glEnable(GL11.GL_TEXTURE_2D);/*from w ww. j a v a 2 s. c o m*/ GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId); CharDataContainer charDataContainer; int charCurrent; GL11.glBegin(GL11.GL_QUADS); int totalwidth = 0; for (int i = 0; i < whatchars.length(); i++) { charCurrent = whatchars.charAt(i); if (charCurrent < 256) { charDataContainer = charData[charCurrent]; } else { charDataContainer = customChars.get((char) charCurrent); } if (charDataContainer != null) { if ((i >= startIndex) || (i <= endIndex)) { drawQuad((x + totalwidth), y, (x + totalwidth + charDataContainer.width), (y + charDataContainer.height), charDataContainer.storedX, charDataContainer.storedY, charDataContainer.storedX + charDataContainer.width, charDataContainer.storedY + charDataContainer.height); } totalwidth += charDataContainer.width; } } GL11.glEnd(); }
From source file:fable.framework.ui.views.chiPlotView.java
License:Open Source License
/** * Build the list to display here/*from w w w. ja v a2 s . c om*/ */ private static void drawReliefList() { if (!reliefListFirst) { GL11.glDeleteLists(reliefList, 1); } reliefListFirst = false; reliefList = GL11.glGenLists(1); GL11.glNewList(reliefList, GL11.GL_COMPILE); GL11.glColor3f(1.0f, 1.0f, 1.0f); // white GL11.glPointSize(pointSize); for (int i = 0; i < imageWidth - 1; i++) { GL11.glBegin(GL11.GL_LINE_STRIP); int j = i + 1; int color_index = (int) image[i]; if (color_index < 0) color_index = 0; if (color_index > COLOR_INDEX_MAX) color_index = COLOR_INDEX_MAX; GL11.glColor3f(red[color_index], green[color_index], blue[color_index]); // temperature lut GL11.glVertex3f(i, image[i], image[j]); // System.out.println("i=" + i + ", j=" + j + " image[i]=" + // image[i] + " image[j]=" + image[j]); GL11.glEnd(); } /* * gl.glBegin(GL.GL_TRIANGLES); * * gl.glVertex3f(-1.0f, -0.5f, 0.0f); // lower left vertex * gl.glVertex3f( 1.0f, -0.5f, 0.0f); // lower right vertex * gl.glVertex3f( 0.0f, 0.5f, 0.0f); // upper vertex * * gl.glEnd(); */ GL11.glEndList(); GL11.glFlush(); }
From source file:fable.imageviewer.views.ReliefView.java
License:Open Source License
private void drawReliefList() { // long started = System.currentTimeMillis(); if (!reliefListFirst) { GL11.glDeleteLists(reliefList, 1); }/*from ww w.j a v a 2 s . c om*/ reliefListFirst = false; reliefList = GL11.glGenLists(1); GL11.glNewList(reliefList, GL11.GL_COMPILE); GL11.glColor3f(1.0f, 1.0f, 1.0f); // white GL11.glPointSize(pointSize); for (int i = 0; i < imageWidth; i++) { GL11.glBegin(GL11.GL_LINE_STRIP); for (int j = 0; j < imageHeight; j++) { int color_index; color_index = (int) image[j * imageWidth + i]; if (color_index < 0) color_index = 0; if (color_index > colorIndexMax) color_index = colorIndexMax; GL11.glColor3f(red[color_index], green[color_index], blue[color_index]); // temperature lut GL11.glVertex3f(i, j, image[j * imageWidth + i]); } GL11.glEnd(); } for (int i = 0; i < imageHeight; i++) { GL11.glBegin(GL11.GL_LINE_STRIP); for (int j = 0; j < imageWidth; j++) { int color_index; color_index = (int) image[i * imageWidth + j]; if (color_index < 0) color_index = 0; if (color_index > colorIndexMax) color_index = colorIndexMax; GL11.glColor3f(red[color_index], green[color_index], blue[color_index]); // temperature lut GL11.glVertex3f(j, i, image[i * imageWidth + j]); } GL11.glEnd(); } GL11.glEndList(); // long elapsed = System.currentTimeMillis()-started; // logger.debug("time to draw relief list "+elapsed+" ms"); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawAxes() { GL11.glBegin(GL11.GL_LINES); GL11.glColor3f(1, 0, 0);/*from ww w . jav a2s . c o m*/ GL11.glVertex3f(0, 0, 0); GL11.glVertex3f(1, 0, 0); GL11.glColor3f(0, 1, 0); GL11.glVertex3f(0, 0, 0); GL11.glVertex3f(0, 1, 0); GL11.glColor3f(0, 0, 1); GL11.glVertex3f(0, 0, 0); GL11.glVertex3f(0, 0, 1); GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void draw2DRect(float x0, float y0, float x1, float y1, float z) { GL11.glBegin(GL11.GL_QUADS); GL11.glNormal3f(0, 0, 1);// w ww.j a v a 2 s .c o m GL11.glTexCoord2d(0, 0); GL11.glVertex3d(x0, y0, z); GL11.glNormal3f(0, 0, 1); GL11.glTexCoord2d(0, 0.9999999); GL11.glVertex3d(x0, y1, z); GL11.glNormal3f(0, 0, 1); GL11.glTexCoord2d(0.9999999, 0.9999999); GL11.glVertex3d(x1, y1, z); GL11.glNormal3f(0, 0, 1); GL11.glTexCoord2d(0.9999999, 0); GL11.glVertex3d(x1, y0, z); GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawRepeatedBackgroundPlane(float rx, float ry, float tx, float ty) { initOrtho();//from www.j a v a 2 s . c o m GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2d(tx, ty + ry); GL11.glVertex3d(0, GLValues.glHeight, -GLValues.glDepth); GL11.glTexCoord2d(tx + rx, ty + ry); GL11.glVertex3d(GLValues.glWidth, GLValues.glHeight, -GLValues.glDepth); GL11.glTexCoord2d(tx + rx, ty); GL11.glVertex3d(GLValues.glWidth, 0, -GLValues.glDepth); GL11.glTexCoord2d(tx, ty); GL11.glVertex3d(0, 0, -GLValues.glDepth); GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawCircle(float r, float d) { GL11.glBegin(GL11.GL_TRIANGLE_FAN); for (float a = (float) ((2.0f * Math.PI) / d); a < 2 * Math.PI; a += (2.0f * Math.PI) / (float) d) { GL11.glNormal3f(0, 0, -1.0f);// w ww . ja v a 2 s .c o m GL11.glTexCoord2d((Math.sin(a) + 1.0f) / 2.0f, (Math.cos(a) + 1.0f) / 2.0f); GL11.glVertex3d(Math.sin(a) * r, Math.cos(a) * r, 0); } GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawHexagon(float r) { GL11.glBegin(GL11.GL_TRIANGLE_FAN); for (float a = (float) ((2.0f * Math.PI) / 6.0f); a < 2 * Math.PI; a += (2.0f * Math.PI) / 6.0f) { GL11.glNormal3f(0, 0, -1.0f);/* w ww. j a v a2s . com*/ GL11.glTexCoord2d((Math.sin(a) + 1.0f) / 2.0f, (Math.cos(a) + 1.0f) / 2.0f); GL11.glVertex3d(Math.sin(a) * r, Math.cos(a) * r, 0); } GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawLineCircle(float radius, float segments, float lineWidth) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, -1); GL11.glLineWidth(lineWidth);//from w ww . j a v a 2 s .co m GL11.glBegin(GL11.GL_LINE_LOOP); for (float a = 0; a < 2 * Math.PI; a += (2.0f * Math.PI) / segments) { GL11.glVertex3d(Math.sin(a) * radius, Math.cos(a) * radius, 0); } GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawLineRect(float w, float x0, float y0, float x1, float y1, float z) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, -1); GL11.glLineWidth(w);/*from w w w.j a v a2s. com*/ GL11.glBegin(GL11.GL_LINE_LOOP); GL11.glVertex3d(x0, y1, z); GL11.glVertex3d(x1, y1, z); GL11.glVertex3d(x1, y0, z); GL11.glVertex3d(x0, y0, z); GL11.glEnd(); }