Compositor compilation fixes for OSG 3.6 and Win32

This commit is contained in:
Richard Harrison
2019-02-19 08:59:54 +01:00
parent 92ec139175
commit dd240116b1
2 changed files with 17 additions and 10 deletions

View File

@@ -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<osg::Texture3D> 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<osg::TextureBuffer> 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<osg::UniformBufferBinding> light_data_ubb =
#if OSG_VERSION_LESS_THAN(3,6,0)
osg::ref_ptr<osg::UniformBufferBinding> 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<osg::UniformBufferBinding> 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);

View File

@@ -23,6 +23,7 @@
#include <osg/Texture3D>
#include <osg/TextureRectangle>
#include <osg/TextureCubeMap>
#include <osg/FrameBufferObject>
#include <simgear/props/props.hxx>
#include <simgear/props/vectorPropTemplates.hxx>
@@ -43,17 +44,17 @@ struct BufferFormat {
PropStringMap<BufferFormat> 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<osg::Texture::WrapMode> wrap_mode_map = {