本文整理汇总了Java中javax.microedition.khronos.opengles.GL10.glMultMatrixf方法的典型用法代码示例。如果您正苦于以下问题:Java GL10.glMultMatrixf方法的具体用法?Java GL10.glMultMatrixf怎么用?Java GL10.glMultMatrixf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.khronos.opengles.GL10
的用法示例。
在下文中一共展示了GL10.glMultMatrixf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDrawFrame
import javax.microedition.khronos.opengles.GL10; //导入方法依赖的package包/类
public void onDrawFrame(GL10 gl) {
/*
* Usually, the first thing one might want to do is to clear
* the screen. The most efficient way of doing this is to use
* glClear().
*/
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
/*
* Now we're ready to draw some 3D objects
*/
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0, 0, -2);
/*
* All the magic happens here. The rotation matrix mR reported by
* SensorManager.getRotationMatrix() is a 4x4 row-major matrix.
* We need to use its inverse for rendering. The inverse is
* simply calculated by taking the matrix' transpose. However, since
* glMultMatrixf() expects a column-major matrix, we can use mR
* directly!
*/
gl.glMultMatrixf(mR, 0);
// some test code which will be used/cleaned up before we ship this.
//gl.glMultMatrixf(mI, 0);
gl.glVertexPointer(3, GL_FLOAT, 0, mVertexBuffer);
gl.glColorPointer(4, GL_FLOAT, 0, mColorBuffer);
gl.glDrawElements(GL_LINES, 6, GL_UNSIGNED_BYTE, mIndexBuffer);
}