当前位置: 首页>>代码示例>>Java>>正文


Java GL2.glLoadIdentity方法代码示例

本文整理汇总了Java中javax.media.opengl.GL2.glLoadIdentity方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glLoadIdentity方法的具体用法?Java GL2.glLoadIdentity怎么用?Java GL2.glLoadIdentity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.media.opengl.GL2的用法示例。


在下文中一共展示了GL2.glLoadIdentity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import javax.media.opengl.GL2; //导入方法依赖的package包/类
public void init(GLAutoDrawable drawable) {
	System.out.println("--init--");
	GL2 gl = drawable.getGL().getGL2();
	glu = new GLU();

	System.out.println("INIT GL IS: " + gl.getClass().getName());
	if (!bDoNurbs) {
		gl.glMap2f(GL2.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, ctlarray, 0);
	}
	gl.glEnable(GL2.GL_MAP2_VERTEX_3);
	gl.glEnable(GL2.GL_AUTO_NORMAL);
	gl.glMapGrid2f(20, 0.0f, 1.0f, 20, 0.0f, 1.0f);

	setupLighting(drawable, gl);
	float fovy=40.f;
	float aspect=1.f;
	float znear=1.f;
	float zfar=20f;
	glu.gluPerspective(fovy, aspect, znear, zfar);

	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glLoadIdentity();
	glu.gluLookAt(cameraLoc.x, cameraLoc.y, cameraLoc.z,
			lookAtPt.x, lookAtPt.y, lookAtPt.z,
			cameraUpDirection.x, cameraUpDirection.y, cameraUpDirection.z);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:27,代码来源:SurfaceTest.java

示例2: init

import javax.media.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(GLAutoDrawable drawable) {
	GL2 gl = drawable.getGL().getGL2();
	glu = new GLU();
	
    /* select clearing color (background) color */
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
 
    /* initialize viewing values */
    gl.glMatrixMode(GL2.GL_PROJECTION);
    gl.glLoadIdentity();
    gl.glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
	
 // Start animator (which should be a field).
       animator = new FPSAnimator(drawable, 60);
       animator.start();
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:18,代码来源:TestFrameComponent.java

示例3: display

import javax.media.opengl.GL2; //导入方法依赖的package包/类
public void display(GLDrawable gLDrawable)
{
  String [] fonts = { "BitMap 9 by 15", "BitMap 8 by 13",
        "Times Roman 10 Point ", "Times Roman 24 Point ",
        "Helvetica 10 Point ","Helvetica 12 Point ","Helvetica 18 Point "};
       
  final GL2 gl = SumoPlatform.getApplication().getGeoContext().getGL().getGL2();
  final GLUT glut = new GLUT();
	 
  gl.glClear (GL.GL_COLOR_BUFFER_BIT);  // Set display window to color.
  gl.glColor3f (0.0f, 0.0f, 0.0f);  // Set text e.color to black
  gl.glMatrixMode (GL2.GL_MODELVIEW);
  gl.glLoadIdentity();
 
  int x = 20, y=15;
  for (int i=0; i<7;i++){
        gl.glRasterPos2i(x,y); // set position
        glut.glutBitmapString(i+2, fonts[i]);
         y+= 20;
  }

}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:23,代码来源:GLTextRender.java

示例4: drawLine

import javax.media.opengl.GL2; //导入方法依赖的package包/类
protected void drawLine(DrawContext dc, Vec4 screenPoint, Vec4 projectedPoint, DetailedOrderedIcon uIcon) {
	//GL gl = dc.getGL();
	GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
	
	gl.glLoadIdentity();
	
	double opacity = uIcon.getOpacity();
	
	opacity = Math.min(opacity, .5f);
	
	gl.glDisable(GL.GL_TEXTURE_2D);
	gl.glColor4d(.2,.2,.2, opacity);
	
	gl.glBegin(GL.GL_LINES);
		gl.glVertex2d(screenPoint.x, screenPoint.y);
		gl.glVertex2d(projectedPoint.x, projectedPoint.y);
	gl.glEnd();
	gl.glEnable(GL.GL_TEXTURE_2D);
	
	gl.glColor4f(1,1,1,1);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:22,代码来源:DetailedIconRenderer.java

示例5: reshape

import javax.media.opengl.GL2; //导入方法依赖的package包/类
public void reshape(GLAutoDrawable drawable, int x, int y, int width,
		int height) {
	GL2 gl = drawable.getGL().getGL2();
	this.drawable = drawable;
	this.width = width;
	this.height = height;

	gl.glMatrixMode(GL2.GL_PROJECTION);
	gl.glLoadIdentity();
	gl.glOrtho(0, width, height, 0, -1, 1);
	gl.glViewport(0, 0, width, height);

	gl.glGetDoublev(GL2.GL_MODELVIEW_MATRIX, modelview);
	gl.glGetDoublev(GL2.GL_PROJECTION_MATRIX, projection);
	gl.glGetIntegerv(GL2.GL_VIEWPORT, viewport);
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:17,代码来源:NetworkRenderer.java

示例6: useCamera

import javax.media.opengl.GL2; //导入方法依赖的package包/类
/**
 *
 * @param openGl
 */
public void useCamera(final GL2 openGl) {
    if (resetProjection) {
        resetProjection = false;
        setProjection(openGl);
    }

    openGl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, new float[]{1000.f,1000.f,1000.f}, 0);
    openGl.glEnable(GL2.GL_LIGHT0);

    openGl.glMatrixMode(GL2.GL_MODELVIEW);
    openGl.glLoadIdentity();
    position.translateBy(openGl);
    product.rotateAround(openGl);
    upVector.rotateAround(openGl);
    
}
 
开发者ID:Fidentis,项目名称:Analyst,代码行数:21,代码来源:Camera.java

示例7: setView

import javax.media.opengl.GL2; //导入方法依赖的package包/类
public void setView(GL2 gl, GLU glu, GlobalState gs) {
    // Select part of window.
    gl.glViewport(0, 0, gs.w, gs.h);
    // Set projection matrix.
    gl.glMatrixMode(GL_PROJECTION);
    //Load the identity matrix.
    gl.glLoadIdentity();
    glu.gluPerspective(fovAngle, (float) gs.w / gs.h, planeNear, planeFar);
    // Set camera.
    gl.glMatrixMode(GL_MODELVIEW);
    //Load the identity matrix.
    gl.glLoadIdentity();
    glu.gluLookAt(eye.x(), eye.y(), eye.z(),
            center.x(), center.y(), center.z(),
            up.x(), up.y(), up.z());
}
 
开发者ID:ABoschman,项目名称:2IV60_RobotRace,代码行数:17,代码来源:CameraMode.java

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

示例9: reshape

import javax.media.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) {
  GL2 gl2 = arg0.getGL().getGL2();

  gl2.glMatrixMode(GL2.GL_PROJECTION);
  gl2.glLoadIdentity();

  // coordinate system origin at lower left with width and height same as the window
  GLU glu = new GLU();
  glu.gluOrtho2D(0.0f, getWidth(), 0.0f, getHeight());

  gl2.glMatrixMode(GL2.GL_MODELVIEW);
  gl2.glLoadIdentity();

  gl2.glViewport(0, 0, getWidth(), getHeight());

  controller.updateExtents(arg3 / 2, arg4 / 2);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:19,代码来源:JoglPanel.java

示例10: updateView

import javax.media.opengl.GL2; //导入方法依赖的package包/类
private void updateView( GL2 gl2 )
{
    gl2 .glMatrixMode( GL2.GL_PROJECTION );
    gl2 .glLoadIdentity();

    // coordinate system origin at lower left with width and height same as the window
    if ( this .fov == 0 )
    	gl2 .glOrtho( - this .halfEdge, this .halfEdge, - this .halfEdge, this .halfEdge, this .near, this .far );
    else
    	this .glu .gluPerspective( this .fov, this .width / this .height, this .near, this .far );
    glu .gluLookAt( 0, 0, (this .far - this .near) / 2f, 0, 0, 0, 0, 1, 0 );

    gl2 .glMatrixMode( GL2.GL_MODELVIEW );
    gl2 .glLoadIdentity();

    gl2 .glViewport( 0, 0, this .width, this .height );
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:18,代码来源:JoglRenderingViewer.java

示例11: setCamera

import javax.media.opengl.GL2; //导入方法依赖的package包/类
private void setCamera() {
      GLU glu=new GLU();
      GL2 gl2=GLU.getCurrentGL().getGL2();
      
// Change to projection matrix.
      gl2.glMatrixMode(GL2.GL_PROJECTION);
      gl2.glLoadIdentity();
      glu.gluOrtho2D(0,gl2.getContext().getGLDrawable().getWidth(),0,
      		gl2.getContext().getGLDrawable().getHeight());
	
      // Change back to model view matrix.
      gl2.glMatrixMode(GL2.GL_MODELVIEW);
      gl2.glLoadIdentity();
  }
 
开发者ID:ec-europa,项目名称:sumo,代码行数:15,代码来源:GLWidget.java

示例12: reshape

import javax.media.opengl.GL2; //导入方法依赖的package包/类
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) 
{
  GL2 gl = drawable.getGL().getGL2();
  gl.glViewport(0, 0, width, height);
  gl.glMatrixMode(GL2.GL_PROJECTION);
  gl.glLoadIdentity();
  glu.gluOrtho2D(0.0f,1.0f,0.0f,1.0f);
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:9,代码来源:Picking.java

示例13: display

import javax.media.opengl.GL2; //导入方法依赖的package包/类
public void display(GLAutoDrawable drawable) 
{
  GL2 gl = drawable.getGL().getGL2();
  switch(cmd)
    {
    case UPDATE:
      drawScene(gl);
      break;
    case SELECT:
      int buffsize = 512;
      double x = (double) mouse_x, y = (double) mouse_y;
      int[] viewPort = new int[4];
      IntBuffer selectBuffer = Buffers.newDirectIntBuffer(buffsize);
      int hits = 0;
      gl.glGetIntegerv(GL2.GL_VIEWPORT, viewPort, 0);
      gl.glSelectBuffer(buffsize, selectBuffer);
      gl.glRenderMode(GL2.GL_SELECT);
      gl.glInitNames();
      gl.glMatrixMode(GL2.GL_PROJECTION);
      gl.glPushMatrix();
      gl.glLoadIdentity();
      glu.gluPickMatrix(x, (double) viewPort[3] - y, 5.0d, 5.0d, viewPort, 0);
      glu.gluOrtho2D(0.0d, 1.0d, 0.0d, 1.0d);
      drawScene(gl);
      gl.glMatrixMode(GL2.GL_PROJECTION);
      gl.glPopMatrix();
      gl.glFlush();
      hits = gl.glRenderMode(GL2.GL_RENDER);
      processHits(hits, selectBuffer);
      cmd = UPDATE;
      break;
    }
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:34,代码来源:Picking.java

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

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


注:本文中的javax.media.opengl.GL2.glLoadIdentity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。