Skip to main content
gamedev.net
🔒 Locked

Directx8 Basic question

Started by spiffycrony 0 replies 750+ views
Original Post
spiffycrony
spiffycrony
I am trying to draw a line whose start point is fixed at origin and the end point will be set to the last mouse click point. My problem is the line's end point is not updated on the screen. I think the following are main steps to do this 1. m_d3d.Device.CreateVertexBuffer 2. Set the data to the vertex buffer (D3DVertexBuffer8SetData) 3. m_d3d.Device.SetStreamSource 4. m_d3d.Device.DrawPrimitive I am calling the step 1 & 2 during the line creation. step 3 & 4 are called in the renderline() function. Whenever I click a new point using the mouse, I update the vertex's x, y, z values and renderline() gets called. In this case the vertex buffer still has only the old values and keeps drawing the line with the original values. Is this right? In order to make the drawing code use the updated vertex's x, y, z values should i call both step 1 & step 2 everytime mouse is clicked or step 2 alone is sufficient?
gharen2
gharen2
You don't need to recreate the vertex buffer each time the line changes, but you do need to update its contents.

So yes, step 2 is sufficient.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.