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:
Private type gameObjects V(3) as D3DTLVERTEX X as single Y as single End Type Dim Things(100) as gameObjects Private Sub Form_load() 'Intialize all the game objects vertex data and store it in the objects End Sub Function DrawMe(what as integer) Device.DrawPrimativeUP Things(i).V(0),2 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:
Private type gameObjects X as single Y as single End Type Dim Things(100) as gameObjects Function DrawMe(what as integer) Dim v(3) as D3DTLVERTEX 'Generate the vertex data and store it in V Device.DrawPrimativeUP v(0),2 End Function




Reply With Quote