Jump to content
  • Advertisement


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

Roof Top Pew Wee

Changing the color of a vertex in the buffer.

This topic is 5998 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

This may be a dumb question, but I don''t know where to look for this one. Say I create a vertex buffer with 4 vertices (a color, D3DXVECTOR3 holding the position, and the tu and tv for texture positioning). How do I access each individual vertex once I do this, so that I can change their colors? Thanks --Vic--

Share this post

Link to post
Share on other sites
You have to "lock" the vertex buffer (vb). Look up the Lock function in the SDK help. You supply a pointer which ends up pointing to the vertices:

MYVERTEX *pVertices;

vertex_buffer->Lock(..... (BYTE **)pVertices .....);

loop i
pVertices-i-.colour = D3DCOLOR(255,255,255);
end loop


There we go. Hope you enjoyed my pseudo-C.

Edited by - freshya on February 19, 2002 9:56:03 PM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!