Android OpenGL ES 开发教程(13):阶段小结

 

之前介绍了什么是 OpenGL ES ,OpenGL ES 管道的概念,什么是EGL,Android中OpenGL ES的开发包以及GLSurfaceView,OpenGL ES所支持的基本几何图形:点,线,面,已及如何使用这些基本几何通过构成较复杂的图像(20面体)。

但到目前为止还只是绘制2D图形,而忽略了一些重要的概念,3D坐标系,和3D坐标变换,在介绍OpenGL ES Demo程序框架时,创建一个OpenGLRenderer 实现 GLSurfaceView.Renderer接口

Java代码 复制代码
  1. public void onSurfaceChanged(GL10 gl, int width, int height) {   
  2.  // Sets the current view port to the new size.  
  3.  gl.glViewport(00, width, height);   
  4.  // Select the projection matrix   
  5.  gl.glMatrixMode(GL10.GL_PROJECTION);   
  6.  // Reset the projection matrix   
  7.  gl.glLoadIdentity();   
  8.  // Calculate the aspect ratio of the window  
  9.  GLU.gluPerspective(gl, 45.0f,   
  10.  (float) width / (float) height,   
  11.  0.1f, 100.0f);   
  12.  // Select the modelview matrix   
  13.  gl.glMatrixMode(GL10.GL_MODELVIEW);   
  14.  // Reset the modelview matrix   
  15.  gl.glLoadIdentity();   
  16.  }   
  17. }  

我们忽略了对glViewport,glMatrixMode,gluPerspective以及20面体时glLoadIdentity,glTranslatef,glRotatef等方法的介绍,这些都涉及到如何来为3D图形构建模型,在下面的几篇将详细介绍OpenGL ES的坐标系和坐标变换已经如何进行3D建模。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值