All pastes #160032 Raw Edit

Unnamed

public java v1 · immutable
·published 2006-09-03 20:03 UTC
rendered paste body
private void glPerspective() {				// used to hold temp data		FloatBuffer buf = BufferUtils.createFloatBuffer(16);						// calculate and save matrices      GL11.glMatrixMode(GL11.GL_PROJECTION);		GL11.glPushMatrix();					// load camera projection			GL11.glLoadIdentity();			GLU.gluPerspective(45,(float)800/600,1,10000);						// save camera projection			buf.clear();			GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, buf);			cameraProjectionMatrix.store(buf);      GL11.glPopMatrix();	    						// load camera view      GL11.glMatrixMode(GL11.GL_MODELVIEW);		    GL11.glLoadIdentity();		    GLU.gluLookAt(camX, camY, camZ, tarX, tarY, tarZ, 0, 1, 0);		    		    // save camera view		    buf.clear();		    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, buf);		    cameraViewMatrix.store(buf);      GL11.glPopMatrix();	    	    	    	    // load back the projection	    GL11.glMatrixMode(GL11.GL_PROJECTION);	    buf.clear();		cameraProjectionMatrix.load(buf);	    buf.flip();		GL11.glLoadMatrix(buf);				// load back the model view		GL11.glMatrixMode(GL11.GL_MODELVIEW);		buf.clear();		cameraViewMatrix.load(buf);		buf.flip();		GL11.glLoadMatrix(buf);	    			    /*// result to achieve	    GL11.glMatrixMode(GL11.GL_PROJECTION);	    GL11.glLoadIdentity();	    GLU.gluPerspective(45,(float)800/600,1,10000);	    	    GL11.glMatrixMode(GL11.GL_MODELVIEW);	    GL11.glLoadIdentity();	    GLU.gluLookAt(camX, camY, camZ, tarX, tarY, tarZ, 0, 1, 0);*/	    	}