bbLoadTexture only loading the red channel....

Archives Forums/Blitz3D SDK Programming/bbLoadTexture only loading the red channel....

Bukky(Posted 2007) [#1]
Hey guys,

I'm using this file to try and get a basic character running around my world:

http://www.psionic3d.co.uk/gallery/albums/uploads/Free%20Stuff/3D%20Models/ninja.zip

Problem is, when I texture him, it seems like bbLoadTexture is only loading the red channel from the provided JPG texture files. Here is a snippet of my code:

	bbGraphics3D(800,600,0,2);

	//load ninja textures:
	BBTexture ninjaBlue=bbLoadTexture ( "media/slopetest/nskinbl.jpg" );
	BBTexture ninjaBrown=bbLoadTexture ( "media/slopetest/nskinbr.jpg" );
	BBTexture ninjaGreen=bbLoadTexture ( "media/slopetest/nskingr.jpg" );
	BBTexture ninjaRed=bbLoadTexture ( "media/slopetest/nskinrd.jpg" );
	BBTexture ninjaWhite=bbLoadTexture( "media/slopetest/nskinwh.jpg" );

	BBEntity Player = bbLoadAnimMesh("media/slopetest/ninja.b3d");
	bbEntityTexture(Player,ninjaBlue);
	BBCamera Camera = bbCreateCamera(Player);



etc. etc. etc.

Then later on in the code, in the main draw loop, I have the following code for swapping textures:

while(!bbKeyHit(Key_Escape))
{
	bbCls();

		//hit the number keys, 1-5, to swap character textures
		if (bbKeyHit(2))
		{	
			bbEntityTexture(Player,ninjaBlue);
		}
		if (bbKeyHit(3))
		{	
			bbEntityTexture(Player,ninjaBrown);
		}
		if (bbKeyHit(4))
		{	
			bbEntityTexture(Player,ninjaGreen);
		}
		if (bbKeyHit(5))
		{	
			bbEntityTexture(Player,ninjaRed);
		}
		if (bbKeyHit(6))
		{	
			bbEntityTexture(Player,ninjaWhite);
		}


		bbUpdateWorld();

		bbRenderWorld();

		bbFlip();
	}


Obviously there's other stuff going on too, I just pasted the relevant code. Anyhow, it seems like only the red channel is being drawn on my model. The results are the same when I try to load any other texture, which otherwise works fine on other objects in my world. Any ideas as far as what I am doing wrong here?


Bukky(Posted 2007) [#2]
Never mind....fixed. :)


Dreamora(Posted 2007) [#3]
Whats the solution?
Not making the entitycolor 255,0,0 ;-)


Bukky(Posted 2007) [#4]
Bingo!