我有一个实现GLSurfaceView.Renderer接口的渲染器; GLSurfaceView的子类和一些表示我想要绘制的对象的类.我有来自http://developer.android.com/training/graphics/opengl/motion.html的代码 我想扩展它并添加一些沿着轴移动并且无法管理它.该对象仅旋转.这是我的代码:
public class NotMyCoolRenderer implements GLSurfaceView.Renderer {
public GLShip mTriangle;
private GLBackgroundStar mSquare;
private final float[] mMVPMatrix = new float[16];
private final float[] mProjMatrix = new float[16];
private final float[] mVMatrix = new float[16];
private final float[] mModelMatrix = new float[16];
private final float[] tempMatrix = new float[16];
public void onDrawFrame(GL10 unused) {
// Draw background color
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
// Set the camera position (View matrix)
Matrix.setLookAtM(mVMatrix, 0, 0, 0, -3, 0f, 0f, 0f, 0f, 1.0f, 0.0f); …
Run Code Online (Sandbox Code Playgroud)