Hi again Johannes,
I hate to say that, ( don't think I enjoy doing it), but it seems to work on
NVidia (at least those above GF 8x00) and I am really surprised it does not
work for you especially when you have advance gpu supporting
GL_EXT_gpu_shader4 extension. In my opinion it shoud work on recent ATI as
well. Is there a chance you misinterpreted some other issue as problem with
matrix arrays in uniforms ? They are pretty common and should work, really.
Can you set OSG_NOTIFY_LEVEL = DEBUG_INFO and see if there are any shader
compilation warnings ? I doubt its the case but I would trace setElement
with debugger and check if it does what you expect. setElement is indexed
with unsigned int. Maybe implicit cast from int caused that compiler have
chosen wrong overload for second parameter and your matrix was not set as
intended. Maybe I am overly cautious here but I once had similar error with
Uniform::set which was ignored due to the fact I passed unsigned value
instead of int value. One should be careful when setting texture sampler
uniform. Its neccessary to explicitly cast constant value to int, otherwise
it could be ignored. For example: TextureUnitUniform.set( int( 0 ) )
Wojtek
--------------------------------------------------
From: "Johannes Schüth" <[email protected]>
Sent: Monday, October 19, 2009 8:24 PM
To: <[email protected]>
Subject: Re: [osg-users] Can't assign more than 7 texture matrices
Hi,
i thought i could use the buildin variabled to save some uniforms. But i
did'nt realize that they were limited.
Well..
i tried to use uniform arrays but with very little sucess:
I create my Uniform:
ref_ptr<Uniform> matrixArrayUniform = new
Uniform(Uniform::FLOAT_MAT4,"matrices",10);
stateSet->addUniform(matrixArrayUniform.get());
later i add 10 matrices:
for (int i = 0; i < 10; i++) {
matrixArrayUniform->setElement(i, texMat->getMatrix());
}
i defined the uniform within my fragment shader:
"uniform mat4 matrices[10];"
and tried to access a matrix via matrices[2] for example but with no luck.
If i use no arrays and limit the size of the uniform to one element
everything works just as expected.
Must i use something other than osg::Uniform::FLOAT_MAT4?
Greetings,
Johannes
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=18404#18404
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org