Advertisement Jump to content
Sign in to follow this  

Object Color modulation

This topic is 4902 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 some complex objects I'd like to color, where complex means lots of verticies. To save memory, I'd like to have just Pos formatted vertex lists (rather that PosDiffuse verts). This is also because the Clr part of every vert would be the same, ie. I'd like these to be flatly colored. But, I'd like to draw several of these 'complex' objects, each with an overall color. Ideally.. D3DDev->SetTextureStageState ( D3DTSS_COLOROP, D3DTA_SELECTARG1); D3DDev->SetTextureStageState ( D3DTSS_COLORARG1, D3DTA_CONSTANT ); D3DDev->SetTextureStageState ( D3DTSS_CONSTANT, overall_object_clr ); ..draw vertex buffer.. I'd like to also be able to do this with textured objects as well, which would basically apply an overall "coloring" to the textured object, as in: D3DDev->SetTextureStageState ( D3DTSS_COLOROP, D3DTA_MODULATE); D3DDev->SetTextureStageState ( D3DTSS_COLORARG1, D3DTA_TEXTURE ); D3DDev->SetTextureStageState ( D3DTSS_COLORARG2, D3DTA_CONSTANT ); D3DDev->SetTextureStageState ( D3DTSS_CONSTANT, overall_object_clr ); Unfortunately, it seems my hardware (Raedon 9600, not an old card) doesn't support D3DTA_CONSTANT (other posts suggest few cards do). It seems the only alternative is to make my vertex buffers PosDiffuse, and assign the object color to every vertex each time a different color is used. But this is a waste of CPU time. Is there any other way to do overall object color modulation? -rcz

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!