Coloured Vertexs..

Started by
3 comments, last by Grofit 20 years, 1 month ago
Hi... Ive got a terrain and ive got it drawing and ive got a texture on it.. but i want to put a wireframe overlay onto it so i can test later on from optimizations... The real question here is how can i overwrite a primitive to draw everything in a certain colour rather than using the texture... In OGL i know you can use: glColor3f(1.0f,0.0f,0.0f); before anything is rendered to overwrite any colour information and draw a vertex as the colour specified...but in D3D is there any way to just overide the use of the texture/colour? Thanks in advance
Advertisement
if you''re using the fixed function pipeline( fvf vertices ), just add a vertex color(D3DFVF_DIFFUSE1 i think ) to the fvf declaration, add that color into your vertex structure, and on texturestagestates:

device->SetTextureStageState( D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
device->SetTextureStageState( D3DTSS_COLORARG1, D3DTA_DIFFUSE );

-Marv
-=~''^''~=-.,_Wicked_,.-=~''^''~=-
Couldn''t you just change your DrawPrimitive type to D3DPT_LINELIST?

/*
I use DirectX 8.1 and C++ (Microsoft Visual C++ 6.0 Professional edition)
*/
yeah you can use a line list...but it will use the texture that is already set...so it wont show up..i want a red or blue colour overlay over the textured terrain...and thanks Ewok... i saw somthing about that on MSDN i will go and lob that in... cheers...

edit-

Is there no way around adding in a diffuse colour part to the FVF and structure...as if ive got 200 structures with an extra float in.. its gonna be a bit less efficient... and if im only using it for debugging purposes.... if i went through the Vertex Shader using HLSL or something could i do it that way by setting the colourarg there and telling it to be a specific colour..?

Thanks again

[edited by - Grofit on February 23, 2004 10:42:05 AM]

[edited by - Grofit on February 23, 2004 10:42:28 AM]
1) Disable colorvertex, set material diffuse.
2) Pixel shader
3) TFactor (old cards like RagePro don't support it properly)
4) Set texture border color, set to texture addr to clamp, and put a texture transform
5) Set fog color. Set fognear/fogfar to 0, enable fog.
6) Vertex Shader.

I'm sure there's more...


[edited by - namethatnobodyelsetook on February 23, 2004 10:56:19 AM]

This topic is closed to new replies.

Advertisement