孔雀开发小屋

专注并致力于手机客户端开发
<2014年1月>
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

统计

  • 随笔 - 103
  • 文章 - 0
  • 评论 - 251
  • 引用 - 0

常用链接

留言簿(38)

随笔分类

随笔档案

关注的博客

朋友的博客

搜索

  •  

最新评论

阅读排行榜

评论排行榜

OpenGL ES中实现gluPerspective函数
在OpenGL中我们可以使用gluPerspective来设置视椎体。但是在OpenGL ES中却没有提供这样的实用库支持,其实我们可以自己来完成这个函数的功能。代码如下:

 1 
 2 void __gluPerspective(double fovy, double aspect, double zNear, double zFar)
 3 {
 4     glMatrixMode(GL_PROJECTION);
 5     glLoadIdentity();
 6 
 7     double xmin, xmax, ymin, ymax;
 8     ymax = zNear * tan(fovy * KPI / 360);
 9     ymin = -ymax;
10     xmin = ymin * aspect;
11     xmax = ymax * aspect;
12 
13     glFrustumf(xmin, xmax, ymin, ymax, zNear, zFar);
14 }
15 
16 

在需要调用gluPerspective的地方,用该函数替换即可。


posted on 2010-08-19 00:14 孔雀 阅读(2809) 评论(4)  编辑 收藏 引用 所属分类: Graphics

评论

# re: OpenGL ES中实现gluPerspective函数 2010-08-19 01:22 bslz

这种傻逼贴你发首页干什么!
  回复  更多评论    

# re: OpenGL ES中实现gluPerspective函数 2010-08-19 08:58 luckcat

话说C++貌似感觉昏了头...
  回复  更多评论    

# re: OpenGL ES中实现gluPerspective函数 2010-09-17 11:36 ccsdu2009

@bslz
我还以为就我一个人被骂呢
  回复  更多评论    

# re: OpenGL ES中实现gluPerspective函数 2014-01-06 20:15 太阳火神的美丽人生

兄弟,glFrustumf 在opengl es 2.0中没有,我是在ios上试的。
  回复  更多评论    

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理