Hi Johannes,

FWIW, Doing & and checking != 0 to detect which fields did changed sounds
reasonable to me.
It's what we're doing in our custom FCs.

Doing it via ~ and == 0 means checking "did only these fields change?",
which is also a valid use case, since one could optimize for that case (not
reupload texture, just change mipmap status?).

But one does need to do something in the "else" section, and I haven't
looked at those classes to see if that is so.

Cheers
/Marcus

2017-02-17 11:12 GMT+01:00 Johannes Brunen <jbru...@datasolid.de>:

> Hello,
>
>
>
> I'm currently writing a chunk class and I'm a little puzzled about the
> 'whichField' and its usage that is provided to the 'changed' procedure.
>
>
>
> I have found the following code in a number of classes:
>
>
>
> void TextureChunk::changed(ConstFieldMaskArg whichField,...)
>
> {
>
>     // Only filter changed? Mipmaps need reinit.
>
>     if((whichField & ~(MinFilterFieldMask | MagFilterFieldMask)) == 0)
>
>     {...
>
>
>
> void TextureObjChunk::changed(ConstFieldMaskArg whichField,...)
>
> { ...
>
>     // Only filter changed? Mipmaps need reinit.
>
>     if((whichField & ~(MinFilterFieldMask | MagFilterFieldMask)) == 0)
>
>     {...
>
>
>
> void GeoProperty::changed(ConstFieldMaskArg whichField, ...)
>
> {
>
>     Inherited::changed(whichField, origin, details);
>
>
>
>     if(0x0000 != (whichField & ~UsageFieldMask))
>
>     {...
>
>
>
> void UniformBufferObjStd140Chunk::changed(ConstFieldMaskArg
> whichField,...)
>
> {...
>
>     if((whichField & ~(UsageFieldMask | BufferFieldMask)) == 0)
>
>     {
>
>         Window::reinitializeGLObject(id);
>
>         ...
>
>
>
> and some more. The last one is created by myself :-(
>
>
>
> After thinking about it, I come to the conclusion that this usage pattern
> is not correct. If I understand correctly the whichField contains a bit
> pattern that has a 1 for each field that has changed. Then if I would like
> to test if that bit is set, I have to do a bit wise & operation to that
> bit. So for instance the TextureObjChunk code should read:
>
>
>
> void TextureObjChunk::changed(ConstFieldMaskArg whichField,...)
>
> { ...
>
>     // Only filter changed? Mipmaps need reinit.
>
>     if((whichField & (MinFilterFieldMask | MagFilterFieldMask)) != 0)
>
>     {...
>
>
>
> Could someone check that please or give me some lecturing so that I
> understand correctly and do it right in the first place next time.
>
>
>
> In the context of the my new chunk class I do have an additional
> questions:
>
>
>
> My chunk is derived from another chunk class that manages some OpenGL
> state. What is the correct way so that the parent chunk works correctly.
> What I mean is how can I force that the parent's 'activate', 'handleGL',
> etc. functions are properly called?
>
> Is this allowed at all?
>
>
>
> Best,
>
> Johannes
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Opensg-users mailing list
> Opensg-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>
>


-- 
Med vänliga hälsningar,
Marcus Lindblom Sonestedt
*Systemarkitekt*
*BIT ADDICT *- Passion för utveckling
+46 (0)706 43 63 28
marcus.lindblom.sonest...@bitaddict.se
www.bitaddict.se
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to