Wrong colour in textures

Started by
1 comment, last by Biggles 22 years, 5 months ago
I am having some problems with the colours in my textures coming up wrong. In the image below the stripes and numbers are drawn using the texture, as is the red of the car body. While the red shows up fine, the stripes and numbers should be the same shade of blue as the fins. This is the code that selects the texture for rendering:
      
	if (pTexture != NULL)
	{
		pDevice->SetTextureStageState (0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
		pDevice->SetTexture (0, pTexture);
	}
	else
	{
		pDevice->SetTextureStageState (0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
		pDevice->SetTexture (0, NULL);
	}
  
This is my vertex:
        
struct imBasicVertex
{
    float x, y, z;
    float nx, ny, nz;
	DWORD Colour;
	float u,v;
};

#define D3DFVF_IMBASICVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX1)
      
At one point when I turned off lighting the texture would go to it's correct colour, but now it doesn't anymore. Anyone got any ideas? Could it possibly be blending with the diffuse of the vertices when it should be using texture (although I don't know how to stop it doing that if it is)? In this case the vertices under that texture have a red diffuse colour. [edit]I just realised that bad blending probably isn't the problem because I've only just modified my vertices to hold diffuse information yesterday, and this was happening well before then when the vertices didn't have diffuse information.[/edit] -------------------- Never eat anything bigger than your own head. Edited by - Biggles on November 16, 2001 1:05:50 AM Edited by - Biggles on November 16, 2001 1:09:57 AM
--------------------Never eat anything bigger than your own head.
Advertisement
You are specifying COLORARG1, but not how to use it. Try adding:
pDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);  

This will insure that no blending is taking place. Maybe you are selecting a different OP somewhere else in your code?
Woo! That fixed it! Thanks!


--------------------

Never eat anything bigger than your own head.
--------------------Never eat anything bigger than your own head.

This topic is closed to new replies.

Advertisement