Changing Colors of an Imported Transparent Texture
I have been able to get my texture to map over the object I am creating, and have been able to create it transparently with alpha blending.
My question is, how do I get the color to change?
I have tried to use something like this:
DWORD color=D3DCOLOR_ARGB(0xFF,255,0,0);
g_device->SetRenderState(D3DRS_TEXTUREFACTOR,color);
But this has not worked as of yet.
Can anyone tell me the basics of changing the color, so I can figure out what I might have done incorrectly?
Thanks!
Did you set up the states to use the Texture Factor?
SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR);
Stay Casual,
Ken
Drunken Hyena
If you want to actually change the pixel''s colors, you must lock the texture to get a pointer to the image data, and manipulate it as needed.
I''m not sure if i understood the original question right, though...
-Nik
I''m not sure if i understood the original question right, though...
-Nik
If you want to change the texture to a specific color you will have to do lock the texture as Nik is suggesting. However, if you are looking to alter the texture output color through blending the Texture Factor you might have a problem in the way that your texture stages are setup.
Can you post the section of code where your setup your texture stages?
_______________________________________
Understanding is a three edged sword...
Can you post the section of code where your setup your texture stages?
_______________________________________
Understanding is a three edged sword...
I have these lines after I read the texture in from the file.
To be perfectly honest, I don''t know what all of these lines do.
Maybe that could be part of the problem.
g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE);
g_pd3dDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE);
g_pd3dDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ONE);
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION );
quote:Original post by shane1985
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
Diffuse? How about setting it to use the texturefactor instead of the vertex diffuse?
quote:Original post by DrunkenHyena
Did you set up the states to use the Texture Factor?
SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR);
Stay Casual,
Ken
Actually, the drunk pointed it out up there aswell
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement