我制作了这段代码,用于在时钟和逆时针方向上旋转一个正方形,实际上这是在 jayway 教程中旋转的示例代码。代码不起作用。提前谢谢。:) 英语也很抱歉..:)
public void onDrawFrame(final GL10 gl) {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try{
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 4.9f,-9.3f);
//gl.glTranslatef(2.0f, 0.0f,0.0f);
gl.glPushMatrix();
gl.glRotatef(-angle, 0, 0, 1);
gl.glScalef(1.0f, 1.0f, 1.0f);
square.draw(gl);
gl.glPopMatrix();
angle++;
Thread.sleep(5000);
}
catch(InterruptedException e){
}
// To do
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 4.9f,-9.3f);
//gl.glTranslatef(2.0f, 0.0f,0.0f);
gl.glPushMatrix();
gl.glRotatef(angle, 0, 0, 1);
//gl.glScalef(1.0f, 1.0f, 1.0f);
square.draw(gl);
gl.glPopMatrix();
angle++;
}
});t.start();