• Advertisement
Sign in to follow this  

basic questions

This topic is 3972 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

when moving objects within world, do i change my world position and then draw the object? scenario i created a shape class that has an array of CustomVertex.PositionColored when the shape class is initialized i setup the vertexes. do i upate the vertex position or do i move the world and then draw my object.. and then reposition my world and continue on with the next object? also, for a rectangle made up of 8 triangles.. i draw a triangle strip of 9 vertexes.. is that the best way to go about it? what is the difference or benefits of using one of the following 2 methods this.vb.SetData(this.triangles, 0, LockFlags.None); or GraphicsStream gs = this.vb.Lock(0, 0, LockFlags.None); gs.Write(this.triangles); thank you

Share this post


Link to post
Share on other sites
Advertisement
To move an object in the world, you want to move the world and draw your object. In general, you want to touch your vertex buffer data as little as possible.

Using a graphics stream allows a more general way of writing to the buffer by letting the vertex buffer work with things that take an abstract Stream object.

You probably want to use SetData, as it's pretty easy to use and is really just combining a lock, write, and unlock for you. How handy!

Share this post


Link to post
Share on other sites
what about the triangle strip.. is that the best method to use for that rectangle?

i plan on making other shapes as well.. such as a T and L etc.. much like tetris (shape wise).. and they will all inherit from a base class, so i'd like to take the best approach.

thank you for the quick reply!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement