List of usage examples for org.lwjgl.opengl GL11 glEnd
public static native void glEnd();
From source file:espresso3d.engine.renderer.E3DGeometryRenderer.java
License:Open Source License
/** * Render a quad's wireframe/*from ww w . j a v a 2 s . co m*/ * @param quad */ private void renderWireframeQuad(E3DQuad quad) { //Setup textures // int glTextureID = -1; // int detail0TextureID = -1; // int detail1TextureID = -1; // // if(quad.getTexture() != null) // glTextureID = quad.getTexture().getGlTextureID(); // if(quad.isTextureDetail0Available()) // detail0TextureID = quad.getTextureDetail0().getGlTextureID(); // if(quad.isTextureDetail1Available()) // detail1TextureID = quad.getTextureDetail1().getGlTextureID(); // // setupTextureUnits(glTextureID, detail0TextureID, detail1TextureID); //Draw vertices // ARBMultitexture.glActiveTextureARB(ARBMultitexture.GL_TEXTURE0_ARB); // GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); //default all white color for the base polygon GL11.glBegin(GL11.GL_LINE_LOOP); // Begin Drawing Triangles // ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE0_ARB, (float)quad.getTextureCoordA().getX(), (float)quad.getTextureCoordA().getY()); GL11.glColor4f((float) quad.getVertexColorA().getA(), (float) quad.getVertexColorA().getB(), (float) quad.getVertexColorA().getC(), (float) quad.getVertexColorA().getD()); GL11.glVertex3f((float) (quad.getVertexPosA().getX()), (float) (quad.getVertexPosA().getY()), (float) (quad.getVertexPosA().getZ())); // ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE0_ARB, (float)quad.getTextureCoordB().getX(), (float)quad.getTextureCoordB().getY()); GL11.glColor4f((float) quad.getVertexColorB().getA(), (float) quad.getVertexColorB().getB(), (float) quad.getVertexColorB().getC(), (float) quad.getVertexColorB().getD()); GL11.glVertex3f((float) (quad.getVertexPosB().getX()), (float) (quad.getVertexPosB().getY()), (float) (quad.getVertexPosB().getZ())); // ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE0_ARB, (float)quad.getTextureCoordC().getX(), (float)quad.getTextureCoordC().getY()); GL11.glColor4f((float) quad.getVertexColorC().getA(), (float) quad.getVertexColorC().getB(), (float) quad.getVertexColorC().getC(), (float) quad.getVertexColorC().getD()); GL11.glVertex3f((float) (quad.getVertexPosC().getX()), (float) (quad.getVertexPosC().getY()), (float) (quad.getVertexPosC().getZ())); // ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE0_ARB, (float)quad.getTextureCoordD().getX(), (float)quad.getTextureCoordD().getY()); GL11.glColor4f((float) quad.getVertexColorD().getA(), (float) quad.getVertexColorD().getB(), (float) quad.getVertexColorD().getC(), (float) quad.getVertexColorD().getD()); GL11.glVertex3f((float) (quad.getVertexPosD().getX()), (float) (quad.getVertexPosD().getY()), (float) (quad.getVertexPosD().getZ())); GL11.glEnd(); }
From source file:espresso3d.engine.renderer.particle.E3DParticleRendererARBPointSprite.java
License:Open Source License
public void renderParticle(E3DParticle particle) { //Setup textures int glTextureID = -1; int detail0TextureID = -1; int detail1TextureID = -1; if (particle.getQuad().isTextureAvailable()) glTextureID = particle.getQuad().getTexture().getGlTextureID(); if (particle.getQuad().isTextureDetail0Available()) detail0TextureID = particle.getQuad().getTextureDetail0().getGlTextureID(); if (particle.getQuad().isTextureDetail1Available()) detail1TextureID = particle.getQuad().getTextureDetail1().getGlTextureID(); setupPointSpriteParameters(particle.getSize()); getEngine().getGeometryRenderer().disableAllTextureUnits(); // if(textured) getEngine().getGeometryRenderer().setupTextureUnits(glTextureID, detail0TextureID, detail1TextureID); E3DVector3F position = null;//from w ww .java 2 s . co m GL11.glBegin(GL11.GL_POINTS); { position = particle.getOrientation().getPosition(); GL14.glPointParameterf(GL14.GL_BLEND_SRC_ALPHA, (float) particle.getAlpha());//(float)particle.getSize());//1f ); GL11.glColor4f(1f, 1f, 1f, (float) particle.getAlpha()); GL11.glVertex3f((float) position.getX(), (float) position.getY(), (float) position.getZ()); } GL11.glEnd(); GL11.glDisable(ARBPointSprite.GL_POINT_SPRITE_ARB); }
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 w w. j av a 2 s . co 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 . j av a 2 s . co m*/ */ 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); }//w w w. j av a 2 s . co m 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);/* w w w. j a v a2s .c o m*/ GL11.glColor3f(1, 0, 0); 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);//from w ww . ja va 2 s .co m GL11.glNormal3f(0, 0, 1); 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 2s . 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);//from www . j a v a 2s . co m 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); 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);//w ww. j a v a 2 s .c om 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); 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(); }