Skip to main content
gamedev.net
🔒 Locked

Texture Problem

Started by lava_hammer 2 replies 350+ views
Original Post
lava_hammer
lava_hammer
I want to do 2D programming with Direct Graphics.(DX9) I defined FVF like this: struct CUSTOMVERTEX { float x,y,z,rhw; DWORD color; float u,v; }; yeah,since I still want to save the vertex color attribute so I can draw some lines or polygens without textures. However,when I rendered the polygens with texture(and I defined the color value for those vertices of course) the polygens' surface were mixed(or blended) the texture with the vertices color. What can I do to hide the 'background color' and only show the texture when it has texture?(I don't want a mixed result.)
-------------------------------Try then you will find the solution.
FeverGames
FeverGames
i think you should seperate both states and make a case where you use FVF with texturing and where you use FVF with color.

i myself am not aware of any state of the device to indicate that it should use vertex color or textures.
Evil Steve
Evil Steve
// Just use texture:pDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1)// Just use diffuse:pDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG2)
The default value for D3DTSS_COLOROP on stage 0 is D3DTOP_MODULATE, meaning the diffuse and texture colour will be mixed.

See the docs page for D3DTEXTURESTAGESTATETYPE.
lava_hammer
lava_hammer
Steve may be right. I shall try it out later.

And I have noticed the advice given by FeverGames.But I can not understand how to create both FVF. Do you mean I should create 2 graphics classes with different FVF and use it seperatly? Or you have some better idea?
-------------------------------Try then you will find the solution.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.