當前位置: 首頁>>代碼示例>>Java>>正文


Java GL2.glVertex3d方法代碼示例

本文整理匯總了Java中javax.media.opengl.GL2.glVertex3d方法的典型用法代碼示例。如果您正苦於以下問題:Java GL2.glVertex3d方法的具體用法?Java GL2.glVertex3d怎麽用?Java GL2.glVertex3d使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.media.opengl.GL2的用法示例。


在下文中一共展示了GL2.glVertex3d方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createVertex

import javax.media.opengl.GL2; //導入方法依賴的package包/類
/**
 * 	Creates a single colour mapped vertex.
 *
 *	@param gl The GL context
 *	@param N The number of points in the X direction
 *	@param M The number of points in the Z direction
 *	@param stepSizeX The size of each quad in the patch
 *	@param stepSizeY The size of each quad in the patch
 *	@param X The index along the X direction
 *	@param Y The index along the Z direction (Y in the data)
 */
private void createVertex( final GL2 gl, final int N, final int M,
		final double stepSizeX, final double stepSizeY, final int X, final int Y )
{
	final double x = X * stepSizeX;
	final double z = Y * stepSizeY;
	double y = this.data[Y][X];

	if( this.autoScale )
		y *= 1d/(this.max-this.min);

	if( this.renderType == HeightMapType.TEXTURED )
		gl.glTexCoord2f( (float)(x / N), (float)(z / M) );
	else
	{
		final float[] c = this.colour;
		if( this.colourMap != null )
			this.colourMap.apply( (float)(this.data[Y][X] * 1d/(this.max-this.min)), c );

		gl.glColor3f( c[0], c[1], c[2] );
	}
	gl.glVertex3d( x, y, z );
}
 
開發者ID:openimaj,項目名稱:openimaj,代碼行數:34,代碼來源:HeightMap3D.java

示例2: renderPatchBoundary

import javax.media.opengl.GL2; //導入方法依賴的package包/類
protected void renderPatchBoundary(DrawContext dc, RectTile tile)
{
   // GL gl = dc.getGL();
	GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
    OGLStackHandler ogsh = new OGLStackHandler();

    ogsh.pushAttrib(gl, GL2.GL_ENABLE_BIT | GL2.GL_CURRENT_BIT | GL2.GL_POLYGON_BIT);
    try
    {
        gl.glDisable(GL.GL_BLEND);

        // Don't perform depth clipping but turn on backface culling
        gl.glDisable(GL.GL_DEPTH_TEST);
        gl.glEnable(GL.GL_CULL_FACE);
        gl.glCullFace(GL.GL_BACK);
        gl.glPolygonMode(GL.GL_FRONT, GL2.GL_LINE);

        Vec4[] corners = tile.sector.computeCornerPoints(dc.getGlobe(), dc.getVerticalExaggeration());

        gl.glColor4d(1d, 0, 0, 1d);
        gl.glBegin(javax.media.opengl.GL2.GL_QUADS);
        gl.glVertex3d(corners[0].x, corners[0].y, corners[0].z);
        gl.glVertex3d(corners[1].x, corners[1].y, corners[1].z);
        gl.glVertex3d(corners[2].x, corners[2].y, corners[2].z);
        gl.glVertex3d(corners[3].x, corners[3].y, corners[3].z);
        gl.glEnd();
    }
    finally
    {
        ogsh.pop(gl);
    }
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:33,代碼來源:MYEBSRectangularTessellator.java

示例3: render

import javax.media.opengl.GL2; //導入方法依賴的package包/類
public void render(DrawContext dc) {
	beginDrawLasso(dc);
	
	//GL gl = dc.getGL();
	GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
	gl.glLoadIdentity();

	gl.glColor3f(1, 1, 0);
	gl.glBegin(GL.GL_LINE_STRIP);

	Vec4 startPoint = null;

	for (Position pos : lasso)
	{
		Vec4 screenPoint = dc.getView().project(
				dc.getGlobe().computePointFromPosition(pos));

		if (screenPoint == null)
			continue;
		if (startPoint == null)
			startPoint = screenPoint;

		gl.glVertex3d(screenPoint.x, screenPoint.y, startPoint.z);
	}
	if (startPoint != null) 
		gl.glVertex3d(startPoint.x, startPoint.y, startPoint.z);

	gl.glEnd();
	endDrawLasso(dc);
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:31,代碼來源:LassoSelectionHandler.java

示例4: drawLine

import javax.media.opengl.GL2; //導入方法依賴的package包/類
private void drawLine(DrawContext dc, Vec4 point, Vec4 next) {
//		GL gl = dc.getGL();
		GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
		gl.glColor3f(1, 1, 0);
		gl.glBegin(GL.GL_LINES);
		gl.glVertex3d(point.x, point.y, point.z);
		gl.glVertex3d(next.x, next.y, next.z);
		gl.glEnd();
	}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:10,代碼來源:FMSRenderer.java

示例5: renderFace

import javax.media.opengl.GL2; //導入方法依賴的package包/類
void renderFace(int i, GL2 gl, int curDistanceAttrib, List<Float> dist) {
    if (i >= facesVertIdxs.size()) {
        return;
    }

    int[] vertIdxs = facesVertIdxs.get(i);
    // get the vertex indicies for face i

    int polytype;
    if (vertIdxs.length == 3) {
        polytype = GL2.GL_TRIANGLES;
    } else if (vertIdxs.length == 4) {
        polytype = GL2.GL_QUADS;
    } else {
        polytype = GL2.GL_POLYGON;
    }
    
  
   
    gl.glBegin(polytype);
    // get the normal and tex coords indicies for face i
    int[] normIdxs = facesNormIdxs.get(i);

    Vector3f vert, norm;
    for (int f = 0; f < vertIdxs.length; f++) {
        if (normIdxs[f] != 0) {  // if there are normals, render them
            norm = normals.get(normIdxs[f] - 1);
            gl.glNormal3d(norm.getX(), norm.getY(), norm.getZ());
        }

         gl.glVertexAttrib1f(curDistanceAttrib,dist.get(vertIdxs[f] - 1));

        vert = verts.get(vertIdxs[f] - 1);  // render the vertices

        gl.glVertex3d(vert.getX(), vert.getY(), vert.getZ());

    }

    gl.glEnd();
}
 
開發者ID:Fidentis,項目名稱:Analyst,代碼行數:41,代碼來源:Faces.java

示例6: drawFilledRectangle

import javax.media.opengl.GL2; //導入方法依賴的package包/類
private void drawFilledRectangle(	final DrawContext dc,
									final Vec4 origin,
									final Dimension dimension,
									final Color color) {
	final GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
	gl.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) color.getAlpha());
	gl.glBegin(GL2.GL_POLYGON);
	gl.glVertex3d(origin.x, origin.y, 0);
	gl.glVertex3d(origin.x + dimension.getWidth(), origin.y, 0);
	gl.glVertex3d(origin.x + dimension.getWidth(), origin.y + dimension.getHeight(), 0);
	gl.glVertex3d(origin.x, origin.y + dimension.getHeight(), 0);
	gl.glVertex3d(origin.x, origin.y, 0);
	gl.glEnd();
}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:15,代碼來源:StatusLayer.java

示例7: render

import javax.media.opengl.GL2; //導入方法依賴的package包/類
@Override
	public void render(final DrawContext dc) {

		final GL2 gl = dc.getGL().getGL2();

		gl.glEnable(GL.GL_DEPTH_TEST);
//		gl.glDepthFunc(GL.GL_LEQUAL);
		gl.glDepthMask(true);
//		gl.glDepthMask(false);
//		gl.glDepthRange(0.0, 1.0);

		try {

			dc.getView().pushReferenceCenter(dc, _placePoint); // draw relative to the place point

			// Pull the arrow triangles forward just a bit to ensure they show over the terrain.
			dc.pushProjectionOffest(0.995);

//			final Color color = this.getAttributes().getTextColor();
//			final Color color = Color.RED;
			final Color color = _lineColor;

			gl.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 0xff);

			gl.glLineWidth(1.0f);
//			gl.glEnable(GL.GL_LINE_SMOOTH);
//			gl.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST);
//			gl.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_DONT_CARE);

			gl.glBegin(GL2.GL_LINE_STRIP);
			{
				gl.glVertex3d(Vec4.ZERO.x, Vec4.ZERO.y, Vec4.ZERO.z);
				gl.glVertex3d(//
						_terrainPoint.x - _placePoint.x,
						_terrainPoint.y - _placePoint.y,
						_terrainPoint.z - _placePoint.z);
			}
			gl.glEnd();

		} finally {

			dc.popProjectionOffest();

			dc.getView().popReferenceCenter(dc);
		}
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:47,代碼來源:TrackPointLine.java

示例8: drawLine_Line

import javax.media.opengl.GL2; //導入方法依賴的package包/類
private void drawLine_Line(final DrawContext dc, final Vec4 annotationPoint) {

		// Compute a terrain point if needed.
		Vec4 terrainPoint = null;
		if (this.altitudeMode != WorldWind.CLAMP_TO_GROUND) {
			terrainPoint = dc.computeTerrainPoint(position.getLatitude(), position.getLongitude(), 0);
		}
		if (terrainPoint == null) {
			return;
		}

		final GL2 gl = dc.getGL().getGL2();

		if ((!dc.isDeepPickingEnabled())) {
			gl.glEnable(GL.GL_DEPTH_TEST);
		}
		gl.glDepthFunc(GL.GL_LEQUAL);
//		gl.glDepthFunc(GL.GL_GREATER); // draw the part that is behind an intersecting surface
		gl.glDepthMask(true);
//		gl.glDepthMask(false);
		gl.glDepthRange(0.0, 1.0);

		try {

			dc.getView().pushReferenceCenter(dc, annotationPoint); // draw relative to the place point

//
// !!! THIS CAUSES A stack overflow1283 because there are only 4 available stack entries !!!
//
//
//			// Pull the arrow triangles forward just a bit to ensure they show over the terrain.
//			dc.pushProjectionOffest(0.95);

			final Color color = this.getAttributes().getTextColor();

			gl.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 0xff);

			gl.glLineWidth(1.5f);
			gl.glHint(GL.GL_LINE_SMOOTH_HINT, Polyline.ANTIALIAS_FASTEST);
			gl.glEnable(GL.GL_LINE_SMOOTH);

//			System.out.println((UI.timeStampNano() + " [" + getClass().getSimpleName() + "] ")
//					+ ("\t" + dc.getFrameTimeStamp()));
//			GLLogger.logDepth(dc, getClass().getSimpleName());
			// TODO remove SYSTEM.OUT.PRINTLN

			gl.glBegin(GL2.GL_LINE_STRIP);
			{
				gl.glVertex3d(Vec4.ZERO.x, Vec4.ZERO.y, Vec4.ZERO.z);
				gl.glVertex3d(//
						terrainPoint.x - annotationPoint.x,
						terrainPoint.y - annotationPoint.y,
						terrainPoint.z - annotationPoint.z);
			}
			gl.glEnd();

//			GLLogger.logDepth(dc, "trackpt");

		} finally {

//			dc.popProjectionOffest();

			dc.getView().popReferenceCenter(dc);
		}
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:66,代碼來源:TrackPointAnnotation.java

示例9: plotObject

import javax.media.opengl.GL2; //導入方法依賴的package包/類
/**
 *	{@inheritDoc}
 * 	@see org.openimaj.vis.general.ItemPlotter3D#plotObject(javax.media.opengl.GLAutoDrawable, org.openimaj.vis.general.XYZVisualisation3D.LocatedObject3D, org.openimaj.vis.general.AxesRenderer3D)
 */
@Override
public void plotObject( final GLAutoDrawable drawable, final LocatedObject3D<Rectangle3D> object,
		final AxesRenderer3D renderer )
{
	// object.object.x,y,z is where we plot the rectangle.
	// object.x,y,z is the data point position.
	final double[] p = renderer.calculatePosition( new double[]
			{ object.object.x, object.object.y, object.object.z } );
	final double[] p2 = renderer.calculatePosition( new double[]
			{ object.x, object.y, object.z } );

	final GL2 gl = drawable.getGL().getGL2();

	gl.glPushMatrix();

	// Translate to the position of the rectangle
	gl.glMatrixMode( GLMatrixFunc.GL_MODELVIEW );
	gl.glTranslated( p2[0], p2[1], p2[2] );
	gl.glRotated( object.object.xRotation, 1, 0, 0 );
	gl.glRotated( object.object.yRotation, 0, 1, 0 );
	gl.glRotated( object.object.zRotation, 0, 0, 1 );

	final double[] dims = renderer.scaleDimension( new double[]{object.object.width,object.object.height,0} );
	final double w = dims[0];
	final double h = dims[1];

	gl.glBegin( GL.GL_LINE_LOOP );
	gl.glVertex3d( p2[0]-p[0], p2[1]-p[1], 0 );
	gl.glVertex3d( p2[0]-p[0]-w, p2[1]-p[1], 0 );
	gl.glVertex3d( p2[0]-p[0]-w, p2[1]-p[1]-h, 0 );
	gl.glVertex3d( p2[0]-p[0], p2[1]-p[1]-h, 0 );
	gl.glEnd();

	gl.glPopMatrix();

	if( this.pos == RectanglePlotPosition.CENTRAL && this.drawDotAtPoint )
	{
		gl.glPushMatrix();
		gl.glMatrixMode( GLMatrixFunc.GL_MODELVIEW );
		gl.glBegin( GL.GL_POINTS );
		gl.glVertex3d( p2[0], p2[1], p2[2] );
		gl.glEnd();
		gl.glPopMatrix();
	}
}
 
開發者ID:openimaj,項目名稱:openimaj,代碼行數:50,代碼來源:Rectangle3DPlotter.java


注:本文中的javax.media.opengl.GL2.glVertex3d方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。