Hello,

I am writing a game using DirectX and have a question about how to optimize speed.

Would the program run faster if:

Each object had its own raw vertex data and when drawing them their data is used. This would use lots or varibles but it loop would be tighter

E.g.

VB Code:
  1. Private type gameObjects
  2. V(3) as D3DTLVERTEX
  3. X as single
  4. Y as single
  5. End Type
  6.  
  7. Dim Things(100) as gameObjects
  8.  
  9. Private Sub Form_load()
  10. 'Intialize all the game objects vertex data and store it in the objects
  11. End Sub
  12.  
  13. Function DrawMe(what as integer)
  14. Device.DrawPrimativeUP Things(i).V(0),2
  15. End Function

OR

Each object did not store its vertex data and a local varible in the drawing function stored the result of generated vertex data. This would use less varibles but the loop would slower.

E.g.

VB Code:
  1. Private type gameObjects
  2. X as single
  3. Y as single
  4. End Type
  5.  
  6. Dim Things(100) as gameObjects
  7.  
  8. Function DrawMe(what as integer)
  9. Dim v(3) as D3DTLVERTEX
  10. 'Generate the vertex data and store it in V
  11. Device.DrawPrimativeUP v(0),2
  12. End Function