From b6f05114dc37cb8bde2e106914c43f68277af5f3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 23 Feb 2015 20:28:37 +0000 Subject: [PATCH] Fixed image allocation operations. git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14713 16af8721-9629-0410-8352-f15c8da7e697 --- src/osg/TransferFunction.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/osg/TransferFunction.cpp b/src/osg/TransferFunction.cpp index fd46467db..4e5763e91 100644 --- a/src/osg/TransferFunction.cpp +++ b/src/osg/TransferFunction.cpp @@ -48,14 +48,15 @@ TransferFunction1D::TransferFunction1D(const TransferFunction1D& tf, const CopyO TransferFunction(tf,copyop) { allocate(tf.getNumberImageCells()); - assign(_colorMap); + assign(tf._colorMap); } void TransferFunction1D::allocate(unsigned int numX) { _image = new osg::Image; _image->allocateImage(numX,1,1,GL_RGBA, GL_FLOAT); - if (!_colorMap.empty()) assign(_colorMap); + + updateImage(); } void TransferFunction1D::clear(const osg::Vec4& color) @@ -177,7 +178,7 @@ osg::Vec4 TransferFunction1D::getColor(float v) const void TransferFunction1D::assign(const ColorMap& newColours) { - _colorMap = newColours; + if (&_colorMap != &newColours) _colorMap = newColours; updateImage(); }