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:espresso3d.engine.renderer.E3DGeometryRenderer.java
License:Open Source License
/** * Render a quad normally (solid or textured) * @param quad/*from w w w. j a va 2 s . c o m*/ */ private void renderTexturedQuad(E3DQuad quad) { int detail0TextureID = -1; int detail1TextureID = -1; if (quad.isTextureDetail0Available()) detail0TextureID = quad.getTextureDetail0().getGlTextureID(); if (quad.isTextureDetail1Available()) detail1TextureID = quad.getTextureDetail1().getGlTextureID(); //Draw vertices ARBMultitexture.glActiveTextureARB(ARBMultitexture.GL_TEXTURE0_ARB); boolean twoSupported = getEngine().getFeatureChecker().getArbMultitextureNumTexUnitsSupported() >= 2; boolean threeSupported = getEngine().getFeatureChecker().getArbMultitextureNumTexUnitsSupported() >= 3; GL11.glBegin(GL11.GL_QUADS); // Begin Drawing Triangles ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE0_ARB, (float) quad.getTextureCoordA().getX(), (float) quad.getTextureCoordA().getY()); if (twoSupported && detail0TextureID != -1) ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE1_ARB, (float) quad.getTextureCoordDetail0A().getX(), (float) quad.getTextureCoordDetail0A().getY()); if (threeSupported && detail1TextureID != -1) ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE2_ARB, (float) quad.getTextureCoordDetail1A().getX(), (float) quad.getTextureCoordDetail1A().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()); if (twoSupported && detail0TextureID != -1) ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE1_ARB, (float) quad.getTextureCoordDetail0B().getX(), (float) quad.getTextureCoordDetail0B().getY()); if (threeSupported && detail1TextureID != -1) ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE2_ARB, (float) quad.getTextureCoordDetail1B().getX(), (float) quad.getTextureCoordDetail1B().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()); if (twoSupported && detail0TextureID != -1) ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE1_ARB, (float) quad.getTextureCoordDetail0C().getX(), (float) quad.getTextureCoordDetail0C().getY()); if (threeSupported && detail1TextureID != -1) ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE2_ARB, (float) quad.getTextureCoordDetail1C().getX(), (float) quad.getTextureCoordDetail1C().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()); if (twoSupported && detail0TextureID != -1) ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE1_ARB, (float) quad.getTextureCoordDetail0D().getX(), (float) quad.getTextureCoordDetail0D().getY()); if (threeSupported && detail1TextureID != -1) ARBMultitexture.glMultiTexCoord2fARB(ARBMultitexture.GL_TEXTURE2_ARB, (float) quad.getTextureCoordDetail1D().getX(), (float) quad.getTextureCoordDetail1D().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.E3DGeometryRenderer.java
License:Open Source License
/** * Render a quad's wireframe/* w w w . j a v a 2s . c om*/ * @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 .ja v a 2s.c o 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:fable.framework.ui.views.chiPlotView.java
License:Open Source License
/** * Build the list to display here/* w w w . j a va 2s . c o 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); }/*from w w 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);/* w ww . ja va2 s .c om*/ 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 drawCube(float r) { r /= 2f;/* ww w. j a va 2 s . c o m*/ GL11.glBegin(GL11.GL_QUADS); // Front Face GL11.glNormal3f(0.0f, 0.0f, 1.0f); // Normal Pointing Towards Viewer GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(-r, -r, r); // Point 1 (Front) GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(r, -r, r); // Point 2 (Front) GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(r, r, r); // Point 3 (Front) GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(-r, r, r); // Point 4 (Front) // Back Face GL11.glNormal3f(0.0f, 0.0f, -1.0f); // Normal Pointing Away From Viewer GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(-r, -r, -r); // Point 1 (Back) GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(-r, r, -r); // Point 2 (Back) GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(r, r, -r); // Point 3 (Back) GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(r, -r, -r); // Point 4 (Back) // Top Face GL11.glNormal3f(0.0f, 1.0f, 0.0f); // Normal Pointing Up GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(-r, r, -r); // Point 1 (Top) GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(-r, r, r); // Point 2 (Top) GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(r, r, r); // Point 3 (Top) GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(r, r, -r); // Point 4 (Top) // Bottom Face GL11.glNormal3f(0.0f, -1.0f, 0.0f); // Normal Pointing Down GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(-r, -r, -r); // Point 1 (Bottom) GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(r, -r, -r); // Point 2 (Bottom) GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(r, -r, r); // Point 3 (Bottom) GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(-r, -r, r); // Point 4 (Bottom) // Right face GL11.glNormal3f(1.0f, 0.0f, 0.0f); // Normal Pointing Right GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(r, -r, -r); // Point 1 (Right) GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(r, r, -r); // Point 2 (Right) GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(r, r, r); // Point 3 (Right) GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(r, -r, r); // Point 4 (Right) // Left Face GL11.glNormal3f(-1.0f, 0.0f, 0.0f); // Normal Pointing Left GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(-r, -r, -r); // Point 1 (Left) GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(-r, -r, r); // Point 2 (Left) GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(-r, r, r); // Point 3 (Left) GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(-r, r, -r); // Point 4 (Left) // Done Drawing Quads GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawLine(float x0, float y0, float x1, float y1, float z0, float z1, float lineWidth) { GL11.glLineWidth(lineWidth);/*www .j a va 2 s . c om*/ GL11.glBegin(GL11.GL_LINES); GL11.glVertex3f(x0, y0, z0); GL11.glVertex3f(x1, y1, z1); GL11.glEnd(); }
From source file:fr.def.iss.vd2.lib_v3d.element.basemap.PolyBasemap.java
License:Open Source License
private void draw() { vertices.clear();// w w w . ja va 2 s . co m stripVertexCount.clear(); float dx = -(minX / 2 + maxX / 2) * innerScale; float dy = -(minY / 2 + maxY / 2) * innerScale; GL11.glPushMatrix(); GL11.glTranslatef(dx, dy, 0); GL11.glScalef(innerScale, innerScale, innerScale); while (stripVertexCount.hasRemaining()) { int lineLenght = stripVertexCount.get(); GL11.glBegin(GL11.GL_LINE_STRIP); // Draw line for (int j = 0; j < lineLenght; j++) { if (vertices.remaining() >= 2) { float x = vertices.get(); float y = vertices.get(); GL11.glVertex3f(x, y, 0.0f); } else { // we should log the problem, but this method is called too // often (each time GL redraws). We don't want to flood the // logs, so we just ignore the problem silently. The // correctness of the data should be done at load time. } } GL11.glEnd(); } GL11.glPopMatrix(); }
From source file:fr.def.iss.vd2.lib_v3d.element.V3DCircle.java
License:Open Source License
private void drawCircle() { GL11.glBegin(GL11.GL_TRIANGLE_FAN);//www. j ava 2 s . co m if (customColor) { GL11.glPushAttrib(GL11.GL_CURRENT_BIT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor3f(innerColor.r, innerColor.g, innerColor.b); } GL11.glVertex3f(0.0f, 0.0f, 0.0f); // center float step = 2f * (float) Math.PI / (float) quality; if (customColor) { GL11.glColor4f(outerColor.r, outerColor.g, outerColor.b, outerColor.a); } for (int i = 0; i <= quality; i++) { GL11.glVertex3f((float) (radius * Math.cos(step * i)), (float) (radius * Math.sin(step * i)), 0f); } if (customColor) { GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glPopAttrib(); } GL11.glEnd(); }