device.RenderState.Lighting = false; //disable lighting
if(collided)
glColor4f(1.0f,0.0f,0.0f,1.0f);
else
glColor4f(1.0f,1.0f,1.0f,1.0f);
collisionSphere.DrawSubset(0); //draw the collision sphere
device.RenderState.Lighting = false; //enable lighting
//draw scene normally
...
DirectX equivalent of glColor4f?
Does anybody know if there is a function in DirectX that does the same thing as a call to glColor4f in OpenGL? Basically, I want to do stuff like:
DirectX has per-vertex colors using PositionColored format, but that doesn't help me. I want to be able to quickly disable lighting and set a constant color for all vertices like in OpenGL. I'm doing this in C# and DX9.0, but anything in C++ would help as well. Thanks.
If you're using pixel shaders, use a shader parameter for that. If you're using texture stages, you can use the texture factor (D3DTA_TFACTOR and D3DRS_TEXTUREFACTOR in C++).
Quote:Original post by ET3D
If you're using pixel shaders, use a shader parameter for that. If you're using texture stages, you can use the texture factor (D3DTA_TFACTOR and D3DRS_TEXTUREFACTOR in C++).
I'm not using shaders and multitexturing. Actually, I would rather disable textures while drawing single color geometry.
Texture stages aren't "multitexturing". Texture stages, like pixel shaders, are simply a way to define a colour output based on parameters like texture coordinates, vertex colours and global colours. Once you understand that, and that you *have* to use them (since you have to define what the output colour will be) life will be easier.
The "fixed function" pixel pipeline, defined using texture stages, is one way to define the colour output. You can set texture stages that will output a single colour, if you want. It's very easy. So I'd suggest reading about them. Or just learn about pixel shaders, if you don't mind limiting your target hardware a bit (and the majority of cards support them).
The "fixed function" pixel pipeline, defined using texture stages, is one way to define the colour output. You can set texture stages that will output a single colour, if you want. It's very easy. So I'd suggest reading about them. Or just learn about pixel shaders, if you don't mind limiting your target hardware a bit (and the majority of cards support them).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement