From 5229280901518c9aeed206869e45eeafe7c881ef Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 31 Mar 2015 19:29:02 +0000 Subject: [PATCH] Added --subload command line option and test subload callback for testing purposes git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14812 16af8721-9629-0410-8352-f15c8da7e697 --- examples/osgtexture2DArray/osgtexture2DArray.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/examples/osgtexture2DArray/osgtexture2DArray.cpp b/examples/osgtexture2DArray/osgtexture2DArray.cpp index 409df5669..4b6b58484 100644 --- a/examples/osgtexture2DArray/osgtexture2DArray.cpp +++ b/examples/osgtexture2DArray/osgtexture2DArray.cpp @@ -39,6 +39,14 @@ typedef std::vector< osg::ref_ptr > ImageList; +class SubloadCallback : public osg::Texture2DArray::SubloadCallback +{ + public: + virtual void load(const osg::Texture2DArray& texture, osg::State& state) const { } + virtual void subload(const osg::Texture2DArray& texture, osg::State& state) const { } +}; + + osg::StateSet* createState(osg::ArgumentParser& arguments) { // read 4 2d images @@ -80,7 +88,12 @@ osg::StateSet* createState(osg::ArgumentParser& arguments) texture->setFilter(osg::Texture2DArray::MIN_FILTER, osg::Texture2DArray::LINEAR_MIPMAP_LINEAR); } - if (arguments.read("--packed")) + if (arguments.read("--subload")) + { + texture->setTextureSize(textureSize, textureSize, 1); + texture->setSubloadCallback(new SubloadCallback()); + } + else if (arguments.read("--packed")) { OSG_NOTICE<<"Packing all images into a single osg::Image to pass to Texture2DArray."<setImage(3, image_3.get()); } - std::string vsFileName("shaders/osgtexture2DArray.vert"); std::string fsFileName("shaders/osgtexture2DArray.frag");