Hi Andi,

On 11/18/2009 03:11 AM, Andreas Halm wrote:
>
> I thought you might say that, but the actual scenario is way more difficult.
> To draw one of the "cubes" I need to use between 3 and 10 textures (out of a
> pool of 120 or so) and one of three shaders. So the probability that two
> sets of resources are identical is quite low. It doesn't seem to be worth
> actually sharing materials, and as I see it, it does not seem to be worth it
> using materials at all.
> To draw one core, I need to be able to switch textures and shaders, which is
> not a problem, I just don't know how to initialize them.
>
> Pseudo code of what I had in mind:
>
> Action::ResultE Type::drawPrimitives(DrawEnv *pEnv)
> {
>       If (texture[0].not_initialized()) {
>               Texture[0].init();
>       }
>       Texture[0].activate(pEnv);
>
>       ... fancy drawing routine ...
>
> }
>
> Plus there may be a better location for initializing the textures and
> shaders, as the resource working set of a core actually doesn't change, only
> sometimes most of the textures might not be used and a different shader
> might be active.

How big are your textures? How serious an issue is it to have them all on the 
card anyway? If you can afford doing that, using a 3D texture is a very simple 
way to switch between texture very dynamically and easily. This texture could 
then be used by different cores, too, even if they have different working sets.

Same for the shaders, how different are thet, would it be possible to merge 
them 
into a supershader?

In general your scenario is a little different from the basic OpenSG design, 
which tries pretty hard to share resource and minimize state changes, therefore 
it separates state and objects using that state fairly clearly.

Your Pseudocode should work fine, but in general OpenGL performance goes down 
quickly if you can only draw small batches of primitives due to intermittent 
state changes. If you can make the batches bigger and replace state changes 
with 
shared/merged state you might be better off.

Yours

        Dirk

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to