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


Java GL2.glMatrixMode方法代码示例

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


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

示例1: reshape

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
    AWTGraphics3D g = (AWTGraphics3D) graphics;
    GL2 gl = g.getGL2(); // get the OpenGL graphics context
    GLU glu = g.getGLU();

    if (height == 0) height = 1;   // prevent divide by zero
    float aspect = (float) width / height;

    // Set the view port (display area) to cover the entire window
    gl.glViewport(0, 0, width, height);

    // Setup perspective projection, with aspect ratio matches viewport
    gl.glMatrixMode(GL2.GL_PROJECTION);  // choose projection matrix
    gl.glLoadIdentity();             // reset projection matrix

    glu.gluPerspective(45.0, aspect, 0.1, 1000.0); // fovy, aspect, zNear, zFar

    // Enable the model-view transform
    gl.glMatrixMode(GL2.GL_MODELVIEW);
    gl.glLoadIdentity(); // reset
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:LogoShowApplication.java

示例2: setCameraMapping

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
private void setCameraMapping(GL2 gl, GLU glu) 
{
	gl.glMatrixMode(GL2.GL_PROJECTION);
	gl.glLoadIdentity();

	gl.glOrtho(-1, 1, -1, 1, 0.01, 1000);
	
	//look at the player from 2.5 units directly above the player 
	glu.gluLookAt(
			inst.player.pos.x + inst.offset.x, inst.player.pos.y + inst.offset.y, 1.5, 
			inst.player.pos.x + inst.offset.x, inst.player.pos.y + inst.offset.y, 0,
			 0, 1, 0);

	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glLoadIdentity();
}
 
开发者ID:ben-j-c,项目名称:TopDownGame,代码行数:17,代码来源:Display.java

示例3: reshape

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height ) {

	GL2 gl = drawable.getGL().getGL2();

	if( height <= 0 ) {
		height = 1;
	}

	final float h = ( float ) width / ( float ) height;
	gl.glViewport( 0, 0, width, height );
	gl.glMatrixMode( GLMatrixFunc.GL_PROJECTION );
	gl.glLoadIdentity();

	glu.gluPerspective( 45.0f, h, 1.0, 20.0 );
	gl.glMatrixMode( GLMatrixFunc.GL_MODELVIEW );
	gl.glLoadIdentity();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:19,代码来源:Triangulation3DViewer.java

示例4: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/** Called by the drawable to initiate OpenGL rendering by the
    client. After all GLEventListeners have been notified of a
    display event, the drawable will swap its buffers if {@link
    GLAutoDrawable#setAutoSwapBufferMode setAutoSwapBufferMode} is
    enabled. */
@Override
public void display(GLAutoDrawable drawable){
	target.update();
	GL2 gl=drawable.getGL().getGL2();
	gl.glClearColor(0,0,0,0f);
	gl.glClear(GL.GL_COLOR_BUFFER_BIT);
	gl.glPushMatrix();
	gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
	gl.glLoadIdentity(); // very important to load identity matrix here so this works after first resize!!!
	gl.glOrtho(0,drawable.getSurfaceWidth() ,0,drawable.getSurfaceHeight(),10000,-10000);
	gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
	gl.glPopMatrix();
	gl.glPushMatrix();
	gl.glColor3f(1,1,1);
	gl.glRectf(target.x()-SIZE, target.y()-SIZE, target.x()+SIZE, target.y()+SIZE);
	//        gl.glColor3f(1,1,1);
	//        gl.glTranslatef(target.x(),target.y(),0);
	//        if(eyeQuad==null) eyeQuad = glu.gluNewQuadric();
	//        glu.gluQuadricDrawStyle(eyeQuad,GLU.GLU_FILL);
	//        glu.gluDisk(eyeQuad,0,5,16,1);
	gl.glPopMatrix();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:28,代码来源:EyeTarget.java

示例5: reshape

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
	GL2 gl = drawable.getGL().getGL2();
	gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
	gl.glLoadIdentity();
	glu.gluOrtho2D(0, width, 0, height); // left, right, bottom, top
	/* layout components */
	Insets insets = getInsets();
	bodyArea = new Rectangle(insets.left, insets.bottom, width - insets.left - insets.right, height - insets.bottom - insets.top);
	// layout title
	titleArea.x = (width - titleArea.width) / 2;
	titleArea.y = height - (insets.top / 2) - titleArea.height;
	bodyArea.height -= titleArea.height;

	layoutComponents(gl, x, y, width, height);

	/* set cliping area for body: left, right, bottom, top. */
	gl.glClipPlane(GL2ES1.GL_CLIP_PLANE0, new double[]{1.0, 0.0, 0.0, -bodyArea.x}, 0);
	gl.glClipPlane(GL2ES1.GL_CLIP_PLANE1, new double[]{-1.0, 0.0, 0.0, bodyArea.x + bodyArea.width}, 0);
	gl.glClipPlane(GL2ES1.GL_CLIP_PLANE2, new double[]{0.0, 1.0, 0.0, -bodyArea.y}, 0);
	gl.glClipPlane(GL2ES1.GL_CLIP_PLANE3, new double[]{0.0, -1.0, 0.0, bodyArea.x + bodyArea.height}, 0);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:23,代码来源:Chart.java

示例6: reshape

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
    AWTGraphics3D g = (AWTGraphics3D) graphics;
    GL2 gl = g.getGL2(); // get the OpenGL graphics context
    GLU glu = g.getGLU();

    if (height == 0) height = 1;   // prevent divide by zero
    float aspect = (float) width / height;

    // Set the view port (display area) to cover the entire window
    gl.glViewport(0, 0, width, height);

    // Setup perspective projection, with aspect ratio matches viewport
    gl.glMatrixMode(GL2.GL_PROJECTION);  // choose projection matrix
    gl.glLoadIdentity();             // reset projection matrix

    glu.gluPerspective(45.0, aspect, 0.1, 100.0); // fovy, aspect, zNear, zFar

    // Enable the model-view transform
    gl.glMatrixMode(GL2.GL_MODELVIEW);
    gl.glLoadIdentity(); // reset
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:AnimationJustLoadApplication.java

示例7: reshape

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2(); // get the OpenGL graphics context
	GLU glu = g.getGLU();

	if (height == 0) height = 1;   // prevent divide by zero
	float aspect = (float)width / height;

	// Set the view port (display area) to cover the entire window
	gl.glViewport(0, 0, width, height);

	// Setup perspective projection, with aspect ratio matches viewport
	gl.glMatrixMode(GL2.GL_PROJECTION);  // choose projection matrix
	gl.glLoadIdentity();             // reset projection matrix

	glu.gluPerspective(45.0, aspect, 0.1, 100.0); // fovy, aspect, zNear, zFar

	// Enable the model-view transform
	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glLoadIdentity(); // reset
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:23,代码来源:Example1.java

示例8: standardScene

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
public static void standardScene(Graphics3D graphics, int x, int y, int w, int h) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	GLU glu = g.getGLU();

	gl.glViewport(x, y, w, h);

	gl.glMatrixMode(GL2.GL_PROJECTION);
	gl.glLoadIdentity();
	
	double aspect = (double)w/(double)h;

	glu.gluPerspective(60.0, aspect, 0.1, 500.0);

	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glLoadIdentity();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:18,代码来源:StandardExample.java

示例9: lookCamera

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
protected void lookCamera(Graphics3D graphics) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	GLU glu = g.getGLU();
	
	gl.glMatrixMode(GL2.GL_MODELVIEW);
	gl.glLoadIdentity();

	double targetx = 0;
	double targety = 0;
	double targetz = 0;
	
	glu.gluLookAt( camera.position.x, camera.position.y, camera.position.z, targetx, targety, targetz, 0, 1, 0 );
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:15,代码来源:Ortographic.java

示例10: display

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
/**
 * Draw the chart view onto OpenGL drawable.
 * The chart is drawn in the rectangular area [0, 0, width-1, height-1].
 */
@Override
public void display(GLAutoDrawable drawable) {
                      drawable.getContext().makeCurrent();
	GL2 gl = drawable.getGL().getGL2();
	gl.glClear(GL.GL_COLOR_BUFFER_BIT);
	gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
	gl.glLoadIdentity();

	// title
	titleRenderer.beginRendering(getWidth(), getHeight());
	titleRenderer.setColor(getForeground());
	titleRenderer.draw(title, titleArea.x, titleArea.y);
	titleRenderer.endRendering();

	// decoration (axes, etc.)
	drawDecoration(gl);

	/* draw body */
	gl.glTranslated(bodyArea.x, bodyArea.y, 0);
	gl.glScaled(bodyArea.width, bodyArea.height, 1);
	// draw background
	gl.glCallList(gridId);

	/* draw series */
	for (Category category : categories) {
		category.draw(gl);
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:33,代码来源:Chart.java

示例11: reshape

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2(); // get the OpenGL graphics context
	
	gl.glViewport(0, 0, width, height);
	gl.glMatrixMode(GL2.GL_PROJECTION);  // choose projection matrix
	gl.glLoadIdentity();             // reset projection matrix
	gl.glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
	gl.glMatrixMode(GL2.GL_MODELVIEW);
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:12,代码来源:CubeExample.java

示例12: init

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void init(GLAutoDrawable drawable)
{
	GL2 gl = drawable.getGL().getGL2();
	gl.glPointSize(5.0f);
	gl.glLineWidth(1.0f);

	gl.glEnable(GL2.GL_BLEND);
	
	gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
	
	
	
	gl.glMatrixMode(GL2.GL_PROJECTION);
	gl.glLoadIdentity();
	gl.glOrtho(-1, 1, -1, 1, 0.01, 1000);
	//gl.glMatrixMode(GL2.GL_MODELVIEW);
	
	
	gl.glEnable(GL2.GL_DEPTH_TEST);
	gl.glDepthFunc(GL2.GL_LEQUAL);

	
	// Enable smooth shading.
	gl.glShadeModel(GL2.GL_SMOOTH);
	gl.glEnable(GL2.GL_BLEND);
	gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);

	// Define "clear" color.
	gl.glClearColor(0f, 0f, 0f, 0f);

	// We want a nice perspective.
	gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST);

	float[] pos = {1,-1,1,0};
	float[] diff = {1,1,1,1};

	gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, diff, 0);
	gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, pos, 0);
	gl.glEnable(GL2.GL_LIGHT0);
	gl.glEnable(GL2.GL_LIGHTING);
	gl.glEnable(GL2.GL_COLOR_MATERIAL);
	
	if(Shoot.DEBUG)
		drawable.getAnimator().setUpdateFPSFrames(25, System.out);

}
 
开发者ID:ben-j-c,项目名称:TopDownGame,代码行数:48,代码来源:Display.java

示例13: reshape

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int w, int h) {
    AWTGraphics3D g = (AWTGraphics3D) graphics;
    GL2 gl = g.getGL2();
    GLU glu = g.getGLU();

    gl.glViewport(x, y, w, h);

    gl.glMatrixMode(GL2.GL_PROJECTION);

    gl.glLoadIdentity();

    glu.gluPerspective(60.0, (double) w / (double) h, 0.1, 500.0);

    gl.glMatrixMode(GL2.GL_MODELVIEW);

    gl.glLoadIdentity();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:19,代码来源:StampApplication.java

示例14: reshape

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	GLU glu = g.getGLU();

	gl.glViewport((int)x, (int)y, (int)w, (int)h);

	gl.glMatrixMode(GL2.GL_PROJECTION);

	gl.glLoadIdentity();

	glu.gluPerspective(60.0, (double) w / (double) h, 0.1, 500.0);

	gl.glMatrixMode(GL2.GL_MODELVIEW);

	gl.glLoadIdentity();

}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:20,代码来源:Perspective.java

示例15: reshape

import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
public void reshape(Graphics3D graphics, int x, int y, int width, int height) {
	AWTGraphics3D g = (AWTGraphics3D) graphics;
	GL2 gl = g.getGL2();
	GLU glu = g.getGLU();

	gl.glViewport((int)x, (int)y, (int)w, (int)h);

	gl.glMatrixMode(GL2.GL_PROJECTION);

	gl.glLoadIdentity();

	glu.gluPerspective(60.0, (double) w / (double) h, 0.1, 500.0);

	gl.glMatrixMode(GL2.GL_MODELVIEW);

	gl.glLoadIdentity();
}
 
开发者ID:Harium,项目名称:propan-jogl-examples,代码行数:19,代码来源:PositionAxis.java


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