Closed gwaldron closed 2 years ago
Can you try:
projectors_.swap(keep);
The move semantics should be built into the swap function anyway; it will be more efficient than an assignment.
Yes, projectors_.swap(keep)
works fine. I will use that instead.
I do have a warning that I'm not sure how to resolve, that I think is related to osgEarth code. I'm seeing on console with example_projectors and latest osgEarth:
Cannot assign between Uniform types float and vec3
Cannot assign between Uniform types float and vec4
This spams a few times. The callstack is:
> osgEarthd.dll!osgEarth::Util::ArrayUniform::ensureCapacity(unsigned int newSize) Line 482 C++
osgEarthd.dll!osgEarth::Util::ArrayUniform::setElement(unsigned int index, const osg::Vec3f & value) Line 402 C++
sdk16-simVisd.dll!simVis::`anonymous namespace'::copyUniform<osg::Vec3f>(osg::StateSet * ss, osg::Uniform * src, unsigned int size, unsigned int index) Line 492 C++
sdk16-simVisd.dll!simVis::ProjectorNode::copyUniformsTo(osg::StateSet * stateSet, unsigned int size, unsigned int index) Line 503 C++
sdk16-simVisd.dll!`anonymous namespace'::ProjectOnNodeUpdater::updateUniforms(osg::StateSet * ss) Line 234 C++
sdk16-simVisd.dll!`anonymous namespace'::ProjectOnNodeUpdater::configureStateSet(osg::StateSet * ss) Line 224 C++
sdk16-simVisd.dll!simVis::ProjectorNode::addProjectionToNode(osg::Node * entity, osg::Node * attachmentPoint) Line 1069 C++
sdk16-simVisd.dll!simVis::EntityNode::acceptProjector(simVis::ProjectorNode * proj) Line 310 C++
example_projectorsd.exe!main(int argc, char * * argv) Line 508 C++
In ArrayUniform::ensureCapacity(2)
, it's dropping into the GL_FLOAT
case. It fails getElement()
call (returns false), then calls setElement()
with a float. This is during the vec3/vec4 calls to ProjectorNode::copyUniform()
calls, as a result of the second call to gateNode->acceptProjector()
in the main()
. The warning doesn't seem to impact functionality, presumably because the value gets set again at a later point. But it looks like osgEarth::Util::ArrayUniform
doesn't seem set up to handle arrays of vec3
and vec4
.
Are you seeing the same warnings? Does the fix belong in ArrayUniform
? I'm not familiar with the code but I can take a look at it if desired.
I am not seeing those warnings. Are you on an NVIDIA card? I did have to update ArrayUniform to support vec4's, in f9c0f26 .. did you get that update?
Yes I am on an NVIDIA card. I am on current master and do have f9c0f26.
ArrayUniform::ensureCapacity()
has no ability to handle vec4, so it retrieves and sets as a float.
OK. I will revisit it..
If it helps, it looks like this error message only shows up in debug mode, not in release mode (though it is still a problem in release).
Ok, I updated osgearth master branch with this fix. Let me know if it works for you
Thanks! Yes the update to osgEarth master works great. I'm working on trying to integrate Blend2D into our osgEarth build across all our systems and afterwards will merge this in.
…ect onto node
Run example_projectors and go to '2' to test.