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


Java GLU.gluOrtho2D方法代碼示例

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


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

示例1: reshape

import javax.media.opengl.glu.GLU; //導入方法依賴的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

示例2: resetWorldWindow

import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
protected void resetWorldWindow(GL gl, GLU glu) {
	
	if(DEBUG)System.out.println("AbstractView: resetWorldWindow() called");
	//System.out.println ("reset world window: " + worldWindowRect );
	// set the world window
	gl.glMatrixMode(GL.GL_PROJECTION);
	gl.glLoadIdentity();
	glu.gluOrtho2D(worldWindowRect.x, worldWindowRect.x
			+ worldWindowRect.width, worldWindowRect.y, worldWindowRect.y
			+ worldWindowRect.height);
	// set viewport
	// args are x, y, width, height
	gl.glViewport(0, 0, viewportWidth, viewportHeight);

	worldWindowChanged = false;
	//initWall();
}
 
開發者ID:chrislee35,項目名稱:visualfirewall,代碼行數:18,代碼來源:AbstractView.java

示例3: setup

import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
private static void setup( GLCanvas glcanvas, GLContext glcontext ) {
    Rectangle rectangle = glcanvas.getClientArea();

    glcanvas.setCurrent();
    glcontext.makeCurrent();

    GL2 gl = glcontext.getGL().getGL2();
    gl.glMatrixMode( GL2.GL_PROJECTION );
    gl.glLoadIdentity();

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

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

    gl.glViewport( 0, 0, rectangle.width, rectangle.height );
    glcontext.release();
}
 
開發者ID:momega,項目名稱:spacesimulator,代碼行數:21,代碼來源:Main.java

示例4: reshape

import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width,
		int height) {
	if (height == 0)
		height = 1;
	float aspect = (float) width / height;
	GL2 gl = drawable.getGL().getGL2();

	gl.glViewport(0, 0, width, height);

	gl.glMatrixMode(GL_PROJECTION);
	gl.glLoadIdentity();
	GLU glu = new GLU();
	glu.gluOrtho2D(0.0f, aspect, 0.0f, 1.0f);

}
 
開發者ID:galaxy-workstation,項目名稱:AircraftDemo,代碼行數:17,代碼來源:ShaderTest.java

示例5: setCamera

import javax.media.opengl.glu.GLU; //導入方法依賴的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

示例6: init

import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
/**
   * Remember that the GLDrawable is actually the 
   * GLCanvas that we dealt with earlier.
   */
  public void init(GLAutoDrawable gld) 
  {	
  	//if(DEBUG)System.out.println("VisualSignatureView: init() called");
      //Remember not to save the
      //GL and GLU objects for 
      //use outside of this method.
      //New ones will be provided 
      //later.
  	GL gl = getGLCanvas().getGL();
GLU glu = new GLU();
              
      gl.glClearColor(BG_RGB[0], BG_RGB[1], BG_RGB[2], 1.0f );
      		
      //Let's make the point 5 pixels wide
      gl.glPointSize(5.0f);
              
      //glViewport's arguments represent
      //left, bottom, width, height
      gl.glViewport(0, 0, (int)WIDTH, (int)HEIGHT);
      gl.glMatrixMode(GL.GL_PROJECTION);
      gl.glLoadIdentity();
      //gluOrtho2D's arguments represent
      //left, right, bottom, top
      glu.gluOrtho2D(0, WIDTH, 0, HEIGHT);
      
      // This is supposed to optimize repeatedly drawn graphics. See 
      // http://fly.cc.fer.hr/~unreal/theredbook/chapter04.html for more info.
      gl.glNewList(DRAW_AXIS, GL.GL_COMPILE);
      	drawAxis(gl);
      gl.glEndList();
  }
 
開發者ID:chrislee35,項目名稱:visualfirewall,代碼行數:36,代碼來源:VisualSignatureView.java

示例7: viewState

import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
/**
 * Returns the current state
 * @param gl the current gl context
 */
public void viewState(GL gl) {
currentState.view(gl);

if(!fadeTimer.isPaused()) {
	gl.glDisable(gl.GL_TEXTURE_2D);
	GLU glu = new GLU();
	gl.glMatrixMode(gl.GL_PROJECTION);
	gl.glPushMatrix();
	gl.glLoadIdentity();
	glu.gluOrtho2D(0.0, ConfigManager.getInstance().width, 0.0, ConfigManager.getInstance().height);
	gl.glMatrixMode(gl.GL_MODELVIEW);
	gl.glLoadIdentity();
	//Draw alpha mask
	setAlpha((float)fadeTimer.read(),gl);
	gl.glBegin(gl.GL_QUADS);
		gl.glVertex2i(0																	,   0																	);
		gl.glVertex2i(ConfigManager.getInstance().width ,   0																	);
		gl.glVertex2i(ConfigManager.getInstance().width , ConfigManager.getInstance().height	);
		gl.glVertex2i(0																	, ConfigManager.getInstance().height	);
	gl.glEnd();
	if(fadeTimer.read()>maxTime) {
		fadeTimer.pause();
	}
	gl.glMatrixMode(gl.GL_PROJECTION);
	gl.glPopMatrix();
	gl.glMatrixMode(gl.GL_MODELVIEW);
	gl.glEnable(gl.GL_TEXTURE_2D);
}
}
 
開發者ID:davidsundelius,項目名稱:Muloks,代碼行數:34,代碼來源:StateManager.java

示例8: setup

import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
protected static void setup( GL2 gl2, int width, int height ) {
    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, width, 0.0f, height );

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

    gl2.glViewport( 0, 0, width, height );
}
 
開發者ID:momega,項目名稱:spacesimulator,代碼行數:14,代碼來源:OneTriangle.java

示例9: setupGL

import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
public static void setupGL(GL2 gl, int width, int height)
{
    gl.glMatrixMode(GL2.GL_PROJECTION);
    gl.glLoadIdentity();

    GLU glu = new GLU();
    glu.gluOrtho2D(0.0, width, 0.0, height);

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

    gl.glViewport(0, 0, width, height);
}
 
開發者ID:vobject,項目名稱:maru,代碼行數:14,代碼來源:GLUtils.java

示例10: render

import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
public void render(GL2 gl2, GLU glu) {
 gl2.glMatrixMode(GL2.GL_PROJECTION);
 gl2.glLoadIdentity();
 glu.gluOrtho2D(0, 0, this.updater.width, this.updater.height);
 gl2.glMatrixMode(GL2.GL_MODELVIEW);
 gl2.glLoadIdentity();
    gl2.glColor3f(1.0F, 1.0F, 1.0F);
    gl2.glDepthMask(false);
 gl2.glDisable(GL2.GL_DEPTH_TEST);
}
 
開發者ID:xtreme8000,項目名稱:aos_remake,代碼行數:11,代碼來源:Screen.java

示例11: view

import javax.media.opengl.glu.GLU; //導入方法依賴的package包/類
/**
 * Displays and animates the skybox
 * @param gl the current gl context
 */
@Override
public void view(GL gl) {
	GLU glu = new GLU();
	
	animate();
	
	gl.glDepthMask(false);
	gl.glMatrixMode(gl.GL_PROJECTION);
	gl.glPushMatrix();
	gl.glLoadIdentity();
	glu.gluOrtho2D(0.0, 800.0 , 0.0, 600.0);
	gl.glMatrixMode(gl.GL_TEXTURE);
	gl.glPushMatrix();
	gl.glLoadIdentity();
	//gl.glRotated(camera.rot*30/(Math.PI*2), 0.0, 0.0, 1.0f);
	gl.glTranslatef(offset[0], offset[1], 0.0f);
	gl.glMatrixMode(gl.GL_MODELVIEW);
	gl.glLoadIdentity();

	gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	gl.glEnable(GL.GL_TEXTURE_2D);
	Texture t = TextureManager.getInstance().getTexture(new File(texturePath));
	t.bind();
	gl.glBegin(gl.GL_QUADS);
	gl.glTexCoord2i(0, 0);
	gl.glVertex2i(0, 0);
	gl.glTexCoord2i(1, 0);
	gl.glVertex2i(800, 0);
	gl.glTexCoord2i(1, 1);
	gl.glVertex2i(800, 800);
	gl.glTexCoord2i(0, 1);
	gl.glVertex2i(0, 800);
	gl.glEnd();
	gl.glDisable(GL.GL_TEXTURE_2D);
	gl.glMatrixMode(gl.GL_PROJECTION);
	gl.glPopMatrix();
	gl.glMatrixMode(gl.GL_TEXTURE);
	gl.glPopMatrix();
	gl.glMatrixMode(gl.GL_MODELVIEW);
	gl.glDepthMask(true);
}
 
開發者ID:davidsundelius,項目名稱:Muloks,代碼行數:46,代碼來源:Skyplane.java


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