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


Java GL2.glDepthFunc方法代碼示例

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


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

示例1: init

import javax.media.opengl.GL2; //導入方法依賴的package包/類
@Override
	public void init( final GLAutoDrawable drawable )
	{
		final GL2 gl = drawable.getGL().getGL2();
		gl.setSwapInterval( 1 );
		gl.glEnable( GL.GL_DEPTH_TEST );
        gl.glDepthFunc( GL.GL_LEQUAL );
        gl.glShadeModel( GLLightingFunc.GL_SMOOTH );
        gl.glHint( GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST );
//		gl.glEnable( GL.GL_BLEND );
//		gl.glBlendFunc( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA );
		gl.glEnable( GL2GL3.GL_POLYGON_SMOOTH );

		final float w = this.window.getDrawableSurface().getWidth();
		final float h = this.window.getDrawableSurface().getHeight();

		// Set the projection matrix (only done once - just here)
		gl.glMatrixMode( GLMatrixFunc.GL_PROJECTION );
		gl.glLoadIdentity();
		this.glu.gluPerspective( 50, (w / h), 0.01, 10 );

		// Set the initial model matrix
		gl.glMatrixMode( GLMatrixFunc.GL_MODELVIEW );
		gl.glLoadIdentity();
		gl.glViewport( 0, 0, (int) w, (int) h ); /* viewport size in pixels */
	}
 
開發者ID:openimaj,項目名稱:openimaj,代碼行數:27,代碼來源:Visualisation3D.java

示例2: beginDrawLasso

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

	int attributeMask =
		GL.GL_DEPTH_BUFFER_BIT // for depth test, depth mask and depth func
			| GL2.GL_TRANSFORM_BIT // for modelview and perspective
			| GL2.GL_VIEWPORT_BIT // for depth range
			| GL2.GL_CURRENT_BIT // for current color
			| GL2.GL_COLOR_BUFFER_BIT // for alpha test func and ref, and blend
			| GL2.GL_DEPTH_BUFFER_BIT // for depth func
			| GL2.GL_ENABLE_BIT; // for enable/disable changes
	gl.glPushAttrib(attributeMask);

	// Apply the depth buffer but don't change it.
	gl.glEnable(GL.GL_DEPTH_TEST);
	gl.glDepthFunc(GL.GL_ALWAYS);
	gl.glDepthMask(false);

	// Load a parallel projection with dimensions (viewportWidth, viewportHeight)
	int[] viewport = new int[4];
	gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);
	gl.glMatrixMode(GL2.GL_PROJECTION);
	gl.glPushMatrix();
	gl.glLoadIdentity();
	gl.glOrtho(0d, viewport[2], 0d, viewport[3], -1d, 1d);

	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glPushMatrix();
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:31,代碼來源:LassoSelectionHandler.java

示例3: 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


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