<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hello Carsten,</div>
<div> </div>
<div>
<div>>> 3.) OSGImage: Added simple hash calculation to be able to compare images<br/>
>> faster.</div>
<div>>+ this->_hashCode = seed;<br/>
>+ for(UInt32 i=0; i<_mfPixel.size(); ++i)<br/>
>+ {<br/>
>+ this->_hashCode =<br/>
>+ this->_hashCode * prime + (Int32)(&(_mfPixel[i]));<br/>
>+ }<br/>
>+<br/>
>+ this->_hashCode = seed;</div>
<div>>err, it looks to me like there's some typos in this [1] and I'm afraid<br/>
>as is this does not give me a warm fuzzy feeling...<br/>
>Is the caching of the hash value important for you (given that it gets<br/>
>invalidated by a change to _any_ field of the image)? Otherwise I would<br/>
>slightly prefer to not make this a member function (Image already has a<br/>
>hugely fat interface), but a free utility function. Also, using<br/>
>OSG::SizeT for the hash code would make this play more nicely with C++11<br/>
>std::hash, which uses std::size_t.</div>
</div>
<div>
<div> </div>
<div>Probably I was sleeping while implementing that..</div>
<div>Hope the following is ok..</div>
<div> </div>
<div>
<div>inline<br/>
OSG::SizeT Image::getHash()<br/>
{<br/>
if(!this->_hashCodeValid)<br/>
{<br/>
// recalculate hash..<br/>
OSG::SizeT seed = 173;<br/>
OSG::SizeT prime = 37;</div>
<div> this->_hashCode = seed;<br/>
for(UInt32 i=0; i<_mfPixel.size(); ++i)<br/>
{<br/>
this->_hashCode = this->_hashCode * prime + _mfPixel[i];<br/>
}<br/>
this->_hashCodeValid = true;<br/>
}</div>
<div> return this->_hashCode;<br/>
}</div>
<div> </div>
<div>Caching the hash value along with the image would be a useful feature as at certain times we do material optimizations which include the necessity to compare images quickly.</div>
<div>Computing the hash values over and over would cause a slowdown...</div>
<div> </div>
<div>Thanks,</div>
<div>Michael</div>
</div>
<div> </div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b> Donnerstag, 07. August 2014 um 11:25 Uhr<br/>
<b>Von:</b> "Carsten Neumann" <***@gmail.com><br/>
<b>An:</b> opensg-***@lists.sourceforge.net<br/>
<b>Betreff:</b> Re: [Opensg-users] OpenSG2.0 - Issues and Improvements</div>
<div name="quoted-content">Hello Michael,<br/>
<br/>
On 08/06/2014 10:22 AM, Michael Raab wrote:<br/>
> we have some problems, actually crashes, on client laptop that use Intel<br/>
> HD chips. The problems are linked to the usage of BlendChunk's and I<br/>
> think we have narrowed it down to the BlendEquation.<br/>
> It seems Intel HD chips and their drivers do not support GL_ARB_imaging<br/>
> extension, which is necessary for glBlendEquation. This problem arised<br/>
> with the switch from 1.8 to 2.0. I checked the BlendChunk implementation<br/>
> for differences and I've got a presumption what may be the problem. In<br/>
> 1.8 the BlendChunk uses ::hasExtension() to check for GL_ARB_imaging.<br/>
> 2.0 uses hasExtOrVersion(). So I guess that the GL version is large<br/>
> enough to get a true here even if the extension is not supported. What<br/>
> is the reason why this check was changed?<br/>
<br/>
my guess would be because it is in the standard since GL version 1.4 or<br/>
thereabouts - not that that would be the first time Intel drivers<br/>
claiming some version/feature as supported and then happily ignore it ;)<br/>
Let me take a look at your follow up patch and see if we can get this to<br/>
work for both conforming and broken drivers.<br/>
<br/>
> Furthermore I've improved some other things:<br/>
> 1.) TextureBuffer::processPreDeactivate(): Check if image is assigned to<br/>
> TextureObj, before accessing it..<br/>
<br/>
fixed,<br/>
<br/>
> 2.) OSGGeoSplitVertexArrayPumpGroup/OSGGeoVertexArrayPumpGroup: We had<br/>
> some Geometries that had at certain times no vertices. Calling<br/>
> glDrawArray with vertexCount 0 caused crashes on some graphics cards. I<br/>
> added a check here.<br/>
<br/>
fixed,<br/>
<br/>
> 3.) OSGImage: Added simple hash calculation to be able to compare images<br/>
> faster.<br/>
<br/>
+ this->_hashCode = seed;<br/>
+ for(UInt32 i=0; i<_mfPixel.size(); ++i)<br/>
+ {<br/>
+ this->_hashCode =<br/>
+ this->_hashCode * prime + (Int32)(&(_mfPixel[i]));<br/>
+ }<br/>
+<br/>
+ this->_hashCode = seed;<br/>
<br/>
err, it looks to me like there's some typos in this [1] and I'm afraid<br/>
as is this does not give me a warm fuzzy feeling...<br/>
Is the caching of the hash value important for you (given that it gets<br/>
invalidated by a change to _any_ field of the image)? Otherwise I would<br/>
slightly prefer to not make this a member function (Image already has a<br/>
hugely fat interface), but a free utility function. Also, using<br/>
OSG::SizeT for the hash code would make this play more nicely with C++11<br/>
std::hash, which uses std::size_t.<br/>
<br/>
> 4.) OSGBlendChunk: In some cases glBlendEquation was used where<br/>
> glBlendEquationEXT should have be used.<br/>
<br/>
-> other mail.<br/>
<br/>
Thanks for the fixes!<br/>
<br/>
Cheers,<br/>
Carsten<br/>
<br/>
<br/>
[1] hash code gets overwritten to seed,<br/>
you seem to be using the address of pixel (truncated to 32 bit) not the<br/>
content?<br/>
<br/>
------------------------------------------------------------------------------<br/>
Infragistics Professional<br/>
Build stunning WinForms apps today!<br/>
Reboot your WinForms applications with our WinForms controls.<br/>
Build a bridge from your legacy apps to the future.<br/>
<a href="http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk" target="_blank">http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk</a><br/>
_______________________________________________<br/>
Opensg-users mailing list<br/>
Opensg-***@lists.sourceforge.net<br/>
<a href="https://lists.sourceforge.net/lists/listinfo/opensg-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/opensg-users</a></div>
</div>
</div>
</div></div></body></html>