Hello Johannes,

On 03/06/2014 10:45 AM, Johannes wrote:
> I would like to add multiple chunks of the new UniformBufferObjChunk to
> a ChunkMaterial object. Is that possible and if so, what do I have to do
> to allow this usage pattern? Do you know of a good example for such a
> StateChunk (LightModelChunk or ClipplaneChunk)?

that is done with a static StateChunkClass member of 
UniformBufferObjChunk - it takes a number of "slots" as a constructor 
argument so that you can attach an instance of the UBOChunk to each of 
these slots.
I did not think of that before, but that would mean that you'd remove 
the binding point from the UBOChunk and instead the binding point is 
implicitly specified through the slot the Chunk occupies - sorry for not 
remembering this earlier, it's been a while since I've looked at those 
code pieces.
That is the same mechanism that is used for multiple textures etc.
The StateChunkClass for textures lives in the base class of 
TextureObjChunk (i.e. TextureBaseChunk) if you want to take a look what 
it does.

> Could you give me an overview explanation of the StateChunk handling?

Does the above help?

> P.S. Attached you can find my very first draft for the
> UniformBufferObjChunk class. Could you please take a look and comment on
> mistakes, errors and so on. It does compile but I did not have tested it
> in any way.

Looks good to me - except the missing StateChunkClass, see above. Please 
note that IIRC the basic idea of the changeFrom method is to be a "more 
efficient" form of deactivate(old),activate(new) sequence, so that would 
also be a valid way to implement it. I'm mentioning this specifically 
because in the past there were some hard to find errors where changeFrom 
had some subtle differences in behaviour (for example early exits had 
slightly different conditions guarding them or some state was not reset 
in one code path but the other).

        Cheers,
                Carsten

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to