当前位置: 首页>>代码示例>>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;未经允许,请勿转载。