当前位置: 首页>>代码示例>>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;未经允许,请勿转载。