PDA

View Full Version : Engine design problem.



Baggio
04-06-2005, 05:49 AM
Iím creating a small 3D engine and Iím having a few problems with something I forgot to think about when I was writing it. I forgot I had to support more that one shader per object. Right now every object is put in a VBO and before rendering I enable the shader applied to that object and disable it after finishing with that object. The problem now is that I have to enable more than one shader per object (one shader per face of an object). Now I was thinking as a solution to make several VBOs per object, one VBO per shader in the object in such way that I avoid changing shaders again and again. Is that a good solution? If not, whatís a better solution?

bChambers
04-06-2005, 09:07 AM
I would recommend using index lists sorted by material, in order to avoid state switches.

If you want a more detailed explanation, let me know.

SeskaPeel
04-07-2005, 02:33 AM
Baggio, you have to split your mesh into subparts depending on their shader ID. You use one big VBO for the whole mesh, but you use different index arrays. You change your shader between each draw call.

SeskaPeel.

Baggio
04-07-2005, 05:34 AM
Ok, I will do that. Thanks for helping me with this problem.