Another quick newbie question [OGL Coder]

Started by
2 comments, last by gimp 21 years, 2 months ago
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]
Chris Brodie
Advertisement
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.

Thanks, I''m picking through the source to donuts4 now, the game menu seems to reflect what you mentioned in item 2.

Thanks.
Chris Brodie
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
Stay Casual,KenDrunken Hyena

This topic is closed to new replies.

Advertisement