Quantcast
Channel: C++博客-FireEmissary
Viewing all articles
Browse latest Browse all 14

freeglut一个易误用的地方

$
0
0
3.0以后的opengl引入了废弃模式和profile定义.其中core profile上下文不支持被废弃的函数.
freeglut支持兼容模式指定:
glutInitContextVersion指定版本
glutInitContextFlags指定是否向后兼容.
glutInitContextProfile指定profile是否core的.

freeglut自带的例子smooth_opengl3把glutInitContextVersion指定参数GLUT_FORWARD_COMPATIBLE,windows平台映射到wgl的WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB标记.而WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB标记的意思是"向前"兼容,也就是说不支持废弃的函数.
这样smooth_opengl3编译出来的例子出现gl错误,什么显示都没有.

解决方案是注释掉glutInitContextFlags调用,因为默认上下文就是以兼容模式建立.
glutInitContextProfile请求opengl 3.2以上版本才有效果,通常可以不管它.


FireEmissary 2010-06-20 18:21 发表评论

Viewing all articles
Browse latest Browse all 14

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>