Texturing an object

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
webjeff
Posts: 66
Joined: Thu May 05, 2005 2:51 am

Texturing an object

Post by webjeff »

I am trying to texture an object and my texture is coming up blueish, I am loading the tga correctly as I confirmed that and I'm passing it to sceGuTexImage correctly as ARGB, but its blueish, I disabled blending... any other ideas? I also tried passing it in as different variations, ABGR, RGBA, etc, but looking at the forums someone said it was ARGB that was the right one...

Either way, its coming up all wrong, blue is showing up where white should be or sorda white.

And Red seems to be black or really really really dark.

Any ideas?
Thanks
Jeff.

PS background is white, dont know if that makes a difference
Chrighton
Posts: 58
Joined: Wed Jun 15, 2005 8:24 pm

Re: Texturing an object

Post by Chrighton »

webjeff wrote:I am trying to texture an object and my texture is coming up blueish, I am loading the tga correctly as I confirmed that and I'm passing it to sceGuTexImage correctly as ARGB, but its blueish, I disabled blending... any other ideas? I also tried passing it in as different variations, ABGR, RGBA, etc, but looking at the forums someone said it was ARGB that was the right one...

Either way, its coming up all wrong, blue is showing up where white should be or sorda white.

And Red seems to be black or really really really dark.
This is clearly indicative that you aren't loading your targa correctly, how are you sure you 'confirmed' it? If you tried different variations, you would have stumbled on the right one in no time, a simple test by converting a red only or blue only or green only image would have put you on the right track, again in no time :)
webjeff wrote:PS background is white, dont know if that makes a difference
Not at all :)

In vram, the least significant bits get the red component, that should get you started...
webjeff
Posts: 66
Joined: Thu May 05, 2005 2:51 am

Post by webjeff »

Well, I have a C++ client app that I was loading the TGA with and I can read the bytes, and with a all red image I saw 0 0 255 255 which means the TGA is stored as BGRA, fine. I used a simple algorithm to change the order to whatever I want. simple enough, however, I have a red image on a box for simplistic measures and its black. Only red, so there is something else wrong here.

Are their any special modes I dont need, here is my texturing code:

Code: Select all

sceGuTexMode(GU_PSM_8888,0,0,0);
sceGuTexImage(0,512,512,512,imageData);
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGBA);
sceGuTexFilter(GU_LINEAR,GU_LINEAR);
sceGuTexScale(1.0f,1.0f);
sceGuTexOffset(0.0f,0.0f);
//sceGuAmbientColor(0xffffffff);
sceGuDisable(GU_BLEND);

I've been messing around with different ambient colors and thinkin I'm not setting TexOFfset correctly or something, not really sure what else could be wrong.

Thanks
Jeff
Chrighton
Posts: 58
Joined: Wed Jun 15, 2005 8:24 pm

Post by Chrighton »

That looks fine actually. You could try ruling out your tga loader routine(s) by manually filling in imageData or another chunk of ram with a red *value*, and try displaying that for a texture, -or- alternatively, just manually loop through imageData and poke it into the framebuffer, to rule out flaws in the GU setup. Otherwise that bit of code is pretty much identical to mine and most everyone else using the sdk samples as a template.

Good luck
Post Reply