你好,游客 登录 注册 搜索
背景:
阅读新闻

Android OpenGL ES->Cube Map

[日期:2012-06-17] 来源:Linux社区  作者:mapdigit [字体:大 中 小]

使用Cube Map,首先要检测设备是否支持Cube Map 材质,本例使用以下代码检测设备是否支持Cube Map。

  1. private boolean checkIfContextSupportsCubeMap(GL10 gl) {  
  2. return checkIfContextSupportsExtension(gl, "GL_OES_texture_cube_map");  
  3.    
  4. }  
  5.    
  6. /** 
  7. * This is not the fastest way to check for an extension, but fine if 
  8. * we are only checking for a few extensions each time a context is created. 
  9. * @param gl 
  10. * @param extension 
  11. * @return true if the extension is present in the current context. 
  12. */  
  13. private boolean checkIfContextSupportsExtension(GL10 gl, String extension) {  
  14. String extensions = " " + gl.glGetString(GL10.GL_EXTENSIONS) + " ";  
  15. // The extensions string is padded with spaces between extensions, but not   
  16. // necessarily at the beginning or end. For simplicity, add spaces at the   
  17. // beginning and end of the extensions string and the extension string.   
  18. // This means we can avoid special-case checks for the first or last   
  19. // extension, as well as avoid special-case checks when an extension name   
  20. // is the same as the first part of another extension name.   
  21. return extensions.indexOf(" " + extension + " ") >= 0;  
  22. }  
linux
相关资讯       Android开发入门 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款