Archived

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

Another quick newbie question [OGL Coder]

This topic is 5433 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'm reading through the docs trying to work out how to change the vertex colour. I want to draw a grey square on the screen. I'm used to just setting the colour to rbg when I want and not having to specify it along with the verts(as it will not change). I found D3DRS_DIFFUSEMATERIALSOURCE, but the doc seems to indicate that this won't work when I switch off the the lighting (which I have already). Any idea's? I'm sure this is about as basic as it gets... Many thanks, [edited by - gimp on January 27, 2003 12:34:17 AM]

Share this post


Link to post
Share on other sites
As far as I recall, there are 3 ways to set a color for an untextured primitive:
1) Use a color component in the vertex
2) Use the material color source (requires lighting. You can turn the lighting on, and activate only a white ambient light, which effectively does nothing)
3) Use a vertex shader, store your constant color in a constant register, and use it with emitted vertices (although vertex shaders are a somewhat advanced topic)

So, I believe you''ll just have to cope with either 1 or 2.
Use a color component in the vertices, that''s the easiest solution I can think of.

Share this post


Link to post
Share on other sites
Thanks, I''m picking through the source to donuts4 now, the game menu seems to reflect what you mentioned in item 2.

Thanks.

Share this post


Link to post
Share on other sites
You can also set the colour by setting the Texture Factor. You set it with a call to SetRenderState, and then set your Texture Stages to use it. ColourOP->SelectARG1, ColourARG1->TFactor

You don''t have to play with lighting or anything else. It''s probably closer to what you were looking for.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites