读书人

Practice1-应用OpenGL ES 设置颜色

发布时间: 2012-09-28 00:03:35 作者: rapoo

Practice1-使用OpenGL ES 设置颜色
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

glView = new GLSurfaceView( this );
glView.setRenderer( this );

setContentView( glView );
}

public void onDrawFrame( GL10 gl ){
//increase red color
redColor += 0.01f;
if( redColor > 1.0f ) redColor = 0.0f;
gl.glClearColor( redColor, 0.0f, 0.0f, 1.0f );

gl.glClear(GLES10.GL_COLOR_BUFFER_BIT|GLES10.GL_DEPTH_BUFFER_BIT );
}

读书人网 >移动开发

热点推荐