• Advertisement
Sign in to follow this  

D3D: Textures and rgb values

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

I have a d3dmesh and a d3dtexture. Does anybody know how to retrieve the rgb values associated with a particualr vertex??? Can't find anything in the MSDN cetnre. Thanks,.

Share this post


Link to post
Share on other sites
Advertisement
Kind of unclear what exactly you're trying to accomplish, but if you want to get the rgb value of the texture that's associated with a particular vertex, then you just get the texture coordinates of that vertex and calculate which texel it represents on your texture.

(assuming 32 bit textures)

x = tx_of_vertex * texture_width
y = ty_of_vertex * texture_height
DWORD color = texture_data[y * texture_width + x]


tx and ty are your respective texture coordinates.

Share this post


Link to post
Share on other sites
Sorry, my post wasa bit convoluted.

But you have described what I needed.

Thanks.

Share this post


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

  • Advertisement