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


Java GL2.glHint方法代碼示例

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


在下文中一共展示了GL2.glHint方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: init

import javax.media.opengl.GL2; //導入方法依賴的package包/類
public void init(GLAutoDrawable drawable) {
	GL2 gl = drawable.getGL().getGL2();
	this.drawable = drawable;

	if (AA_SMOOTHING) {
		// Anti-aliasing using Smoothing
		if (AA_SMOOTH_LINES) {
			gl.glEnable(GL2.GL_LINE_SMOOTH);
			gl.glHint(GL2.GL_LINE_SMOOTH_HINT, GL2.GL_NICEST);
		}

		// TODO: This AA method creates "transparency" in GLU polygons
		if (AA_SMOOTH_POLYGONS) {
			gl.glEnable(GL2.GL_POLYGON_SMOOTH);
			gl.glHint(GL2.GL_POLYGON_SMOOTH_HINT, GL2.GL_NICEST);
		}

		if (AA_SMOOTH_POINTS) {
			gl.glEnable(GL2.GL_POINT_SMOOTH);
			gl.glHint(GL2.GL_POINT_SMOOTH_HINT, GL2.GL_NICEST);
		}

		gl.glEnable(GL2.GL_BLEND);
		gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);

	} else if (AA_MULTISAMPLING) {
		// Anti-aliasing using Multisampling
		gl.glEnable(GL2.GL_MULTISAMPLE);
	}

	gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);

	// Renderers
	this.vertexRenderer = new VertexRenderer(drawable, this);
	this.edgeRenderer = new EdgeRenderer(drawable, this);
	this.labelRenderer = new LabelRenderer(drawable, this);
}
 
開發者ID:dev-cuttlefish,項目名稱:cuttlefish,代碼行數:38,代碼來源:NetworkRenderer.java

示例3: initialize

import javax.media.opengl.GL2; //導入方法依賴的package包/類
@SuppressWarnings("static-access")
protected void initialize(GL2 gl2) {
    if (initialized_context_ == gl2) {
        return;
    }

    initialized_context_ = gl2;

    if (!gl2.getContext().isHardwareRasterizer()) {
        // Workaround for Windows Remote Desktop which requires pot textures.
        CefApp.getLogger().info("opengl rendering may be slow as hardware rendering isn't available");
        use_draw_pixels_ = true;
        return;
    }

    gl2.glHint(gl2.GL_POLYGON_SMOOTH_HINT, gl2.GL_NICEST);

    gl2.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

    // Necessary for non-power-of-2 textures to render correctly.
    gl2.glPixelStorei(gl2.GL_UNPACK_ALIGNMENT, 1);

    // Create the texture.
    gl2.glGenTextures(1, texture_id_, 0);
    assert (texture_id_[0] != 0);

    gl2.glBindTexture(gl2.GL_TEXTURE_2D, texture_id_[0]);
    gl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MIN_FILTER, gl2.GL_NEAREST);
    gl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MAG_FILTER, gl2.GL_NEAREST);
    gl2.glTexEnvf(gl2.GL_TEXTURE_ENV, gl2.GL_TEXTURE_ENV_MODE, gl2.GL_MODULATE);
}
 
開發者ID:Panda-Programming-Language,項目名稱:Pandomium,代碼行數:32,代碼來源:CefRenderer.java

示例4: initialize

import javax.media.opengl.GL2; //導入方法依賴的package包/類
@SuppressWarnings("static-access")
protected void initialize(GL2 gl2) {
  if (initialized_context_ == gl2)
    return;

  initialized_context_ = gl2;

  if (!gl2.getContext().isHardwareRasterizer()) {
    // Workaround for Windows Remote Desktop which requires pot textures.
    System.out.println("opengl rendering may be slow as hardware rendering isn't available");
    use_draw_pixels_ = true;
    return;
  }

  gl2.glHint(gl2.GL_POLYGON_SMOOTH_HINT, gl2.GL_NICEST);

  gl2.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

  // Necessary for non-power-of-2 textures to render correctly.
  gl2.glPixelStorei(gl2.GL_UNPACK_ALIGNMENT, 1);

  // Create the texture.
  gl2.glGenTextures(1, texture_id_, 0);
  assert(texture_id_[0] != 0);

  gl2.glBindTexture(gl2.GL_TEXTURE_2D, texture_id_[0]);
  gl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MIN_FILTER, gl2.GL_NEAREST);
  gl2.glTexParameteri(gl2.GL_TEXTURE_2D, gl2.GL_TEXTURE_MAG_FILTER, gl2.GL_NEAREST);
  gl2.glTexEnvf(gl2.GL_TEXTURE_ENV, gl2.GL_TEXTURE_ENV_MODE, gl2.GL_MODULATE);
}
 
開發者ID:viglucci,項目名稱:app-jcef-example,代碼行數:31,代碼來源:CefRenderer.java

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