forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Load and used some texture ? (3D gu)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Poison_xtreamlua



Joined: 10 Aug 2007
Posts: 12

PostPosted: Thu May 15, 2008 6:23 am    Post subject: Load and used some texture ? (3D gu) Reply with quote

Hi there,

I'm programming a 3D homebrew (my first 3D homebrew :p) and I wonder if it's possible to load and use more than one texture, can we used 3 , 4 or 5 texture ? (I'm using this class to load texture : http://www.psp-programming.com/code/doku.php?id=c:pspgu-neheport-lesson5 ), and if it's possible how ?

Should I do this :

Code:

   texture1.LoadTGA("data/texture/intro.tga");
   texture1.Swizzle();

   texture2.LoadTGA("data/texture/intro.tga");
   texture2.Swizzle();

       //....some lines
   sceGuEnable(GU_TEXTURE_2D);

   sceGuTexMode(GU_PSM_8888, 0, 0, texture1.Swizzled());
   sceGuTexMode(GU_PSM_8888, 0, 0, texture2.Swizzled());
   sceGuTexFunc(GU_TFX_DECAL, GU_TCC_RGB);
   sceGuTexFilter( GU_LINEAR, GU_LINEAR );
   sceGuTexScale( 1.0f, 1.0f );
   sceGuTexOffset( 0.0f, 0.0f );


Or should I do this :

Code:

   texture1.LoadTGA("data/texture/intro.tga");
   texture1.Swizzle();

   texture2.LoadTGA("data/texture/intro.tga");
   texture2.Swizzle();

       //....some lines
   sceGuEnable(GU_TEXTURE_2D);

   sceGuTexMode(GU_PSM_8888, 0, 0, texture1.Swizzled());
   sceGuTexFunc(GU_TFX_DECAL, GU_TCC_RGB);
   sceGuTexFilter( GU_LINEAR, GU_LINEAR );
   sceGuTexScale( 1.0f, 1.0f );
   sceGuTexOffset( 0.0f, 0.0f );

   sceGuTexMode(GU_PSM_8888, 0, 0, texture2.Swizzled());
   sceGuTexFunc(GU_TFX_DECAL, GU_TCC_RGB);
   sceGuTexFilter( GU_LINEAR, GU_LINEAR );
   sceGuTexScale( 1.0f, 1.0f );
   sceGuTexOffset( 0.0f, 0.0f );


Thanks :)

NB : Is it possible to load a 512 *512 tga ? Because it seems to bug when I try to blit the texture,whereas when I load the same image but in 256 *256 it works perfectly ?

Thanks again
Back to top
View user's profile Send private message
quadrizo



Joined: 23 Aug 2007
Posts: 21

PostPosted: Thu May 15, 2008 8:33 am    Post subject: Reply with quote

of course you can use more than one texture

but it seems to me you confuse the loading and use

loading :
Code:

   texture1.LoadTGA("data/texture/intro.tga");
   texture1.Swizzle();

and use:
Code:

   sceGuEnable(GU_TEXTURE_2D);

   sceGuTexMode(GU_PSM_8888, 0, 0, texture1.Swizzled());
   sceGuTexImage(0, ..., (void*) texture1.data);
   sceGuTexFunc(GU_TFX_DECAL, GU_TCC_RGB);
   sceGuTexFilter( GU_LINEAR, GU_LINEAR );
   sceGuTexScale( 1.0f, 1.0f );
   sceGuTexOffset( 0.0f, 0.0f );
...
   sceGuDrawArray(....
...
  sceGuTexMode(GU_PSM_8888, 0, 0, texture2.Swizzled());
  sceGuTexImage(0, ..., (void*) texture2.data);
...
  sceGuDrawArray(....

sceGuTexFunc,sceGuTexMode,sceGuTexFilter,...are used to give parameters to apply to the texture

and size limits are 512x512.... maybe a bug in your code
Back to top
View user's profile Send private message
jsharrad



Joined: 20 Oct 2005
Posts: 102

PostPosted: Thu May 15, 2008 8:36 am    Post subject: Reply with quote

First one is fine provided you don't want different filtering / other texture options for each texture.

Getting errors when loading a 512x512 texture or not displaying correctly is probably because you're trying to load the whole thing into vram and there isn't enough vram left over after setting up the depth, draw, and display buffers for a texture that size (1mb).

If you're using 32 bit framebuffers, you only have about 700k vram left over.
Back to top
View user's profile Send private message
Poison_xtreamlua



Joined: 10 Aug 2007
Posts: 12

PostPosted: Thu May 15, 2008 4:25 pm    Post subject: Reply with quote

quadrizo -> Thanks , you have resolved one of my problem, I was programming with a wrong code ^^ .

jsharrad -> Thanks for those information :) , but how I know if I load textures in VRAM or in RAM ? And how to choose :p ?

Because RAM have an higher capacity than VRAM (I mean RAM is bigger than VRAM) ?

Thanks again ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group