diff --git a/simgear/scene/viewer/ClusteredForward.cxx b/simgear/scene/viewer/ClusteredForward.cxx index 9235a71f..e2b50180 100644 --- a/simgear/scene/viewer/ClusteredForward.cxx +++ b/simgear/scene/viewer/ClusteredForward.cxx @@ -72,8 +72,8 @@ ClusteredForwardDrawCallback::operator()(osg::RenderInfo &renderInfo) const if (!_initialized) { // Create and associate the light grid 3D texture _light_grid->allocateImage(n_htiles, n_vtiles, 1, - GL_RGB_INTEGER, GL_UNSIGNED_SHORT); - _light_grid->setInternalTextureFormat(GL_RGB16UI); + GL_RGB_INTEGER_EXT, GL_UNSIGNED_SHORT); + _light_grid->setInternalTextureFormat(GL_RGB16UI_EXT); osg::ref_ptr light_grid_tex = new osg::Texture3D; light_grid_tex->setResizeNonPowerOfTwoHint(false); @@ -88,7 +88,7 @@ ClusteredForwardDrawCallback::operator()(osg::RenderInfo &renderInfo) const 10, light_grid_tex.get(), osg::StateAttribute::ON); // Create and associate the light indices TBO - _light_indices->allocateImage(4096, 1, 1, GL_RED_INTEGER, GL_UNSIGNED_SHORT); + _light_indices->allocateImage(4096, 1, 1, GL_RED_INTEGER_EXT, GL_UNSIGNED_SHORT); osg::ref_ptr light_indices_tbo = new osg::TextureBuffer; @@ -103,10 +103,16 @@ ClusteredForwardDrawCallback::operator()(osg::RenderInfo &renderInfo) const new osg::UniformBufferObject; _light_data->setBufferObject(light_data_ubo.get()); - osg::ref_ptr light_data_ubb = +#if OSG_VERSION_LESS_THAN(3,6,0) + osg::ref_ptr light_data_ubb = new osg::UniformBufferBinding(0, light_data_ubo.get(), 0, MAX_POINT_LIGHTS * 8 * sizeof(GLfloat)); - light_data_ubb->setDataVariance(osg::Object::DYNAMIC); +#else + osg::ref_ptr light_data_ubb = + new osg::UniformBufferBinding(0, _light_data.get(), + 0, MAX_POINT_LIGHTS * 8 * sizeof(GLfloat)); +#endif +light_data_ubb->setDataVariance(osg::Object::DYNAMIC); camera->getOrCreateStateSet()->setAttribute( light_data_ubb.get(), osg::StateAttribute::ON); diff --git a/simgear/scene/viewer/CompositorBuffer.cxx b/simgear/scene/viewer/CompositorBuffer.cxx index b52b5530..183e4de5 100644 --- a/simgear/scene/viewer/CompositorBuffer.cxx +++ b/simgear/scene/viewer/CompositorBuffer.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -43,17 +44,17 @@ struct BufferFormat { PropStringMap buffer_format_map { {"rgb8", {GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE}}, {"rgba8", {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}}, - {"rgb16f", {GL_RGB16F, GL_RGBA, GL_FLOAT}}, - {"rgb32f", {GL_RGB32F, GL_RGBA, GL_FLOAT}}, - {"rgba16f", {GL_RGBA16F, GL_RGBA, GL_FLOAT}}, - {"rgba32f", {GL_RGBA32F, GL_RGBA, GL_FLOAT}}, + {"rgb16f", {GL_RGB16F_ARB, GL_RGBA, GL_FLOAT}}, + {"rgb32f", {GL_RGB32F_ARB, GL_RGBA, GL_FLOAT}}, + {"rgba16f", {GL_RGBA16F_ARB, GL_RGBA, GL_FLOAT}}, + {"rgba32f", {GL_RGBA32F_ARB, GL_RGBA, GL_FLOAT}}, {"r32f", {GL_R32F, GL_RED, GL_FLOAT}}, {"rg32f", {GL_RG32F, GL_RG, GL_FLOAT}}, {"depth16", {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}}, {"depth24", {GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_FLOAT}}, {"depth32", {GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_FLOAT}}, {"depth32f", {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}}, - {"depth-stencil", {GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT}} + {"depth-stencil", { GL_DEPTH24_STENCIL8_EXT, GL_DEPTH_STENCIL_EXT, GL_FLOAT}} }; PropStringMap wrap_mode_map = {