本文整理匯總了Java中javax.media.opengl.GL2.glMultMatrixf方法的典型用法代碼示例。如果您正苦於以下問題:Java GL2.glMultMatrixf方法的具體用法?Java GL2.glMultMatrixf怎麽用?Java GL2.glMultMatrixf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.media.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glMultMatrixf方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: transformViewport
import javax.media.opengl.GL2; //導入方法依賴的package包/類
public void transformViewport(GL2 gl, Vec2 center) {
Vec2 e = viewportTransform.getExtents();
Vec2 vc = viewportTransform.getCenter();
Mat22 vt = viewportTransform.getMat22Representation();
int f = viewportTransform.isYFlip() ? -1 : 1;
mat[0] = vt.ex.x;
mat[4] = vt.ey.x;
// mat[8] = 0;
mat[12] = e.x;
mat[1] = f * vt.ex.y;
mat[5] = f * vt.ey.y;
// mat[9] = 0;
mat[13] = e.y;
// mat[2] = 0;
// mat[6] = 0;
// mat[10] = 1;
// mat[14] = 0;
// mat[3] = 0;
// mat[7] = 0;
// mat[11] = 0;
// mat[15] = 1;
gl.glMultMatrixf(mat, 0);
gl.glTranslatef(center.x - vc.x, center.y - vc.y, 0);
}
示例2: transformViewport
import javax.media.opengl.GL2; //導入方法依賴的package包/類
public void transformViewport(GL2 gl, Vec2 center) {
Vec2 e = viewportTransform.getExtents();
Vec2 vc = viewportTransform.getCenter();
Mat22 vt = viewportTransform.getMat22Representation();
int f = viewportTransform.isYFlip() ? -1 : 1;
mat[0] = vt.ex.x;
mat[4] = vt.ey.x;
// mat[8] = 0;
mat[12] = e.x;
mat[1] = f * vt.ex.y;
mat[5] = f * vt.ey.y;
// mat[9] = 0;
mat[13] = e.y;
// mat[2] = 0;
// mat[6] = 0;
// mat[10] = 1;
// mat[14] = 0;
// mat[3] = 0;
// mat[7] = 0;
// mat[11] = 0;
// mat[15] = 1;
gl.glMultMatrixf(mat, 0);
gl.glTranslatef(center.x - vc.x, center.y - vc.y, 0);
}
示例3: draw
import javax.media.opengl.GL2; //導入方法依賴的package包/類
@Override
public void draw(GL2 gl) {
boolean lastFrame2D = wasLastFrame2D();
super.draw(gl);
// Clear the color-buffer to white:
gl.glClearColor(0x0, 0x0, 0x0, 0);
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
this.setCamera(gl, this.glu, this.width, this.height);
// this.setLights(gl);
gl.glLoadIdentity();
if(state.is2DMode() != lastFrame2D) {
oldRotation = new FloatVector3D(0, 0, 0);
System.arraycopy(IDENTITY, 0, modelViewMatrix, 0, IDENTITY.length);
gl.glRotatef(-90, 1, 0, 0);
gl.glMultMatrixf(modelViewMatrix, 0);
gl.glGetFloatv(GL2.GL_MODELVIEW_MATRIX, modelViewMatrix, 0);
gl.glLoadIdentity();
}
FloatVector3D relativeRotation = new FloatVector3D(oldRotation);
relativeRotation.sub(state.getRotation());
// rotate the globe
gl.glRotatef(relativeRotation.getX(), 1, 0, 0);
gl.glRotatef(relativeRotation.getY(), 0, 1, 0);
// compute 'old' rotation
gl.glMultMatrixf(modelViewMatrix, 0);
// reset the rotations
oldRotation = new FloatVector3D(state.getRotation());
// store the current rotation in the GL-state
gl.glGetFloatv(GL2.GL_MODELVIEW_MATRIX, modelViewMatrix, 0);
this.drawEarth(gl);
}