Archived

This topic is now archived and is closed to further replies.

Dwiel

Rending multiple objects

Recommended Posts

I have many Objects like Buttons, Listboxes, ect that I want to render with DirectX(could be OpenGL or whatever). Different objects use different textures, Vertex Types, ect. If you render all of the objects w/ a certain texture, at one time, you won''t have to change the texture as often, but by doing this, you might have to change the Vertex Buffer many times. for example I have these Objects: Object1: VB1, Tex1 Object2: VB2, Color1 Object3: VB1, Tex2 Object4: VB1, Tex1 Object5: VB2, Color2 Now I could render them this way: SetTexture(tex1); SetVB(VB1); Draw(Object1); SetVB(VB2); SetColor(Color1) Draw(Object2); ... for every object ... SetVB(VB2); SetColor(Color2); Draw(Object5); this takes 10 changes Or I Could do it like this: SetVB(VB1); SetTexture(tex1); Draw(Object1); Draw(Object4); SetTexture(tex2); Draw(Object3); SetVB(VB2); SetColor(Color1); Draw(Object2); SetColor(Color2); Draw(Object5); this takes 6 changes Or I could do it like this: SetTexture(tex1); SetVB(VB1); Draw(Object1); Draw(Object4); SetTexture(tex2); SetVB(VB1); Draw(Object3); SetColor(Color1); SetVB(VB2); Draw(Object2); SetColor(Color2); SetVB(VB2); Draw(Object5); this takes 8 changes The Middle method works best in this situation, Is there an algo to determine which one is the fastest. If there is, is it fast enough to be completed in at least the time it saves by making the least number of changes. In other words, is it fast enough to help the fps? Hope You guys can help Thanx Tazzel3D ~ Zach

Share this post


Link to post
Share on other sites