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


Java GL2.GL_CURRENT_BIT屬性代碼示例

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


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

示例1: beginDrawLasso

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,代碼行數:30,代碼來源:LassoSelectionHandler.java

示例2: beginDrawIcons

@Override
protected void beginDrawIcons(DrawContext dc) {
  GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

	this.oglStackHandler.clear();

	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
			| GL.GL_COLOR_BUFFER_BIT // for alpha test func and ref, and blend
			| GL2.GL_TEXTURE_BIT // for texture env
			| GL.GL_DEPTH_BUFFER_BIT // for depth func
			| GL2.GL_ENABLE_BIT; // for enable/disable changes
	this.oglStackHandler.pushAttrib(gl, attributeMask);

	// Apply the depth buffer but don't change it.
	if ((!dc.isDeepPickingEnabled())) {
		gl.glEnable(GL.GL_DEPTH_TEST);
	}
	gl.glDepthMask(false);

	// Suppress any fully transparent image pixels
	gl.glEnable(GL2.GL_ALPHA_TEST);
	gl.glAlphaFunc(GL.GL_GREATER, 0.001f);

	// Load a parallel projection with dimensions (viewportWidth, viewportHeight)
	this.oglStackHandler.pushProjectionIdentity(gl);
	gl.glOrtho(0d, dc.getView().getViewport().width, 0d, dc.getView().getViewport().height, -16d, 16d);

	this.oglStackHandler.pushModelview(gl);
	this.oglStackHandler.pushTexture(gl);

	if (dc.isPickingMode())
	{
		this.pickSupport.beginPicking(dc);

		// Set up to replace the non-transparent texture colors with the single pick color.
		gl.glEnable(GL.GL_TEXTURE_2D);
		gl.glTexEnvf(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_COMBINE);
		gl.glTexEnvf(GL2.GL_TEXTURE_ENV, GL2.GL_SRC0_RGB, GL2.GL_PREVIOUS);
		gl.glTexEnvf(GL2.GL_TEXTURE_ENV, GL2.GL_COMBINE_RGB, GL2.GL_REPLACE);
	}
	else
	{
		gl.glEnable(GL.GL_TEXTURE_2D);
		gl.glEnable(GL.GL_BLEND);
		gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
	}

	//Only calculate pitch / heading once **
	heading = this.computeHeading(dc.getView());
	pitch = this.computePitch(dc.getView());
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:55,代碼來源:DetailedIconRenderer.java


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