pouët.net

Go to bottom

[code] d3d effect (.fx shader) instances

category: general [glöplog]
 
hi! does anyone have some suggestions on how to best deal with several meshes sharing 1 shader? I see two alternatives:

1.) load the d3d effect file once, and when loading meshes use d3deffect->clone() and setting all runtime-invariant parameters (textures, constants, etc.). so at render-time i only have to set the non-constant parameters.

2.) instead of using clone() one could simply store a pointer to the loaded effect/shader. but then one has to set _all_ parameters (even most constant ones), most notably re-setting textures, everytime when rendering those meshes (each mesh can have different textures/parameters but use same shader)...

which one is faster/better?
thanks for your help!
added on the 2006-10-01 18:41:49 by arm1n arm1n
You would have to set _all_ parameters every time you render something anyway. The only difference is that the effect framework may abstract this from you.
added on the 2006-10-01 18:59:54 by imbusy imbusy

login

Go to top