OSG 的例子中, 使用GL3 的CMake配置說明

/*
 * Add the path to <GL3/gl3.h> to the CMake compiler flags, CMAKE_CXX_FLAGS and
   CMAKE_CXX_FLAGS_DEBUG (for release and debug builds; others if you use other
   build configurations). The text to add should look something like this:
     /I 揅:\GLHeader?   The folder GLHeader should contain a subfolder GL3, which in turn contains
   gl3.h.

 * Enable the following CMake variable:
     OSG_GL3_AVAILABLE

 * Disable the following CMake variables:
     OSG_GL1_AVAILABLE
     OSG_GL2_AVAILABLE
     OSG_GLES1_AVAILABLE
     OSG_GLES2_AVAILABLE
     OSG_GL_DISPLAYLISTS_AVAILABLE
     OSG_GL_FIXED_FUNCTION_AVAILABLE
     OSG_GL_MATRICES_AVAILABLE
     OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE
     OSG_GL_VERTEX_FUNCS_AVAILABLE
**/
  • 這麼配置以後, OSG有不少渲染不兼容了. 例如:反射貼圖, cow.osg上的貼圖. 在控制檯會報錯
  • 不開啓GL3, 也是能用高版本的GLSL
  • 沒用GL3的設置編譯的話 須要加這段代碼, 以能使用相關的Uniform
osg::ref_ptr< osg::GraphicsContext > gc1 = setWindowed(viewer1);
	gc1->getState()->setUseModelViewAndProjectionUniforms(true);
	gc1->getState()->setUseVertexAttributeAliasing(true);

osg_ModelViewProjectionMatrix 這個Uniform參數要麼用GL3的設置編譯底層庫, 要麼加這兩句設置ui

相關文章
相關標籤/搜索