how to set my texture ?

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

Moderators: cheriff, TyRaNiD

Post Reply
skwi
Posts: 22
Joined: Tue May 16, 2006 4:28 am

how to set my texture ?

Post by skwi »

I want to use textures from a table with the texture, but this don"t work, somes lignes of my texture are skipped
my textures is :

Code: Select all

static unsigned char __attribute__((aligned(16))) texture[]={0x00,0x00, 0xFF,0xFF, 0x00,0x00, 0xFF,0xFF,
								0xFF,0xFF, 0x00,0x00, 0xFF,0xFF, 0x00,0x00,
								0x00,0x00, 0xFF,0xFF, 0x00,0x00, 0xFF,0xFF,
								0xFF,0xFF, 0x00,0x00, 0xFF,0xFF, 0x00,0x00,
								0x00,0x00, 0xFF,0xFF, 0x00,0x00, 0xFF,0xFF,
								0xFF,0xFF, 0x00,0x00, 0xFF,0xFF, 0x00,0x00,
								0x00,0x00, 0xFF,0xFF, 0x00,0x00, 0xFF,0xFF,
								0xFF,0xFF, 0x00,0x00, 0xFF,0xFF, 0x00,0x00};
I use it like this :

Code: Select all

sceGuTexMode(GU_PSM_4444,0,0,0);
		sceGuTexImage(0,4,4,4,texture);
		sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
		sceGuTexEnvColor(0xffff00);
		//sceGuTexFilter(GU_LINEAR,GU_LINEAR);
		sceGuTexScale(1.0f,1.0f);
		sceGuTexOffset(0.0f,0.0f);
my texture should be :
W B W B
B W B W
W B W B
B W B W

but the half of the lignes are skipped
and this result in :
W B W B
W B W B
W B W B
W B W B

what i'm doing wrong ?

thank you
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Re: how to set my texture ?

Post by Raphael »

skipped lines and alike are often a sign that you have your texture size/stride or pixel format set incorrectly to the rasterizer. Since I can't see anything wrong with that though, it must be in the setup of the texture coordinates you provide with your vertices. Probably they get clipped, so only drawing the first line every time, or maybe they are too large (ie, > 2 times the size they should be, thus skipping lines). Have you set texture clipping to clamp? Try to set it to repeat and see what happens.
skwi
Posts: 22
Joined: Tue May 16, 2006 4:28 am

Post by skwi »

thank you for your help but i have resolved my problem using larger textures, with a 8*8 texture everything work fine
seems like the minimum Texture Buffer Width is 8 because in my old texture (i've put in my first message) i have a 4*4 texture buffer and it skip lines acting like if the Texture Buffer Width was 8
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

Hehe, now that you say. 4 pixels * 2 bytes = 8 bytes, but textures need to be aligned to 16 bytes, so every second line is not aligned and gets "skipped" :P
If my theory is correct 32bit 4x4 textures should work.
skwi
Posts: 22
Joined: Tue May 16, 2006 4:28 am

Post by skwi »

maybe but i haven't test 4*4 in 32 bits but i don"t have any 4*4 textures, it was only a test

but now i've got another problem, with lights, i've add lights to my programm and i can't see any light

i've added
sceGuEnable(GU_LIGHTING);
sceGuEnable(GU_LIGHT0);

with the others GU setup



I've add :

ScePspFVector3 pos = { 0, 1, 0 };
sceGuLight(0,GU_POINTLIGHT,GU_DIFFUSE_AND_SPECULAR,&pos);
sceGuLightColor(0,GU_DIFFUSE,0xffff0000);
sceGuLightColor(0,GU_SPECULAR,0xffffffff);

sceGuSpecular(12.0f);
sceGuAmbient(0x00222222);


into my program to setup the light


and then i've add normals :
sceGumDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_NORMAL_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_3D,nb_face*3,0,verticestabl);
my verticestabl is now with normals



but my model is not shaded

i've forgot something ?

thank you for the answer
skwi
Posts: 22
Joined: Tue May 16, 2006 4:28 am

Post by skwi »

actually the light problem was in the makefile

my old makefile :
CFLAGS = -G0 -Wall

I've added "-O2" :
CFLAGS = -G0 -Wall -O2

ans now lighting is working
ector
Posts: 195
Joined: Thu May 12, 2005 10:22 pm

Post by ector »

If changing the optimization setting "fixed" it, you have a bug somewhere...
http://www.dtek.chalmers.se/~tronic/PSPTexTool.zip Free texture converter for PSP with source. More to come.
skwi
Posts: 22
Joined: Tue May 16, 2006 4:28 am

Post by skwi »

i think you"re right but i can"t find where
and now i've got a very strange problem, when I allocate the memory for my texture, it change the z coordinate of the first point of my mesh
i really don"t understand why i've got all theses strange problems

here is the whole code :

Code: Select all

#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>

#include <malloc.h>

#include <pspgu.h>
#include <pspgum.h>
#include <pspctrl.h>

PSP_MODULE_INFO&#40;"3D Test", 0, 1, 1&#41;;
PSP_MAIN_THREAD_ATTR&#40;THREAD_ATTR_USER&#41;;

static unsigned int __attribute__&#40;&#40;aligned&#40;16&#41;&#41;&#41; list&#91;262144&#93;;

float valtest;

int exitRequest = 0;

int running&#40;&#41;
&#123;
	return !exitRequest;
&#125;

int exitCallback&#40;int arg1, int arg2, void *common&#41;
&#123;
	exitRequest = 1;
	return 0;
&#125;

int callbackThread&#40;SceSize args, void *argp&#41;
&#123;
	int cbid;

	cbid = sceKernelCreateCallback&#40;"Exit Callback", exitCallback, NULL&#41;;
	sceKernelRegisterExitCallback&#40;cbid&#41;;

	sceKernelSleepThreadCB&#40;&#41;;

	return 0;
&#125;

int setupCallbacks&#40;void&#41;
&#123;
	int thid = 0;

	thid = sceKernelCreateThread&#40;"update_thread", callbackThread, 0x11, 0xFA0, 0, 0&#41;;
	if&#40;thid >= 0&#41;
	&#123;
		sceKernelStartThread&#40;thid, 0, 0&#41;;
	&#125;

	return thid;
&#125;




struct objet
&#123;
	float *vertices;
	int nb_face;
	char *texture;
	int hauteur;//de la texture
        int largeur;//de la texture
	char nom&#91;16&#93;;
	int etat;
	float x,y,z,xrot,yrot,zrot;
&#125;;

int chargeobj&#40;struct objet* objet&#41;
&#123;
 
	int nb_vert=0, nb_texc=0, nb_norm=0;
	&#40;*objet&#41;.nb_face=0;
  FILE * fichier1;
  char ligne&#91;256&#93;;
  char nomobj&#91;16&#93;;
  char nomtex&#91;16&#93;;
  sprintf&#40;nomobj,"%s.txt",&#40;*objet&#41;.nom&#41;;
  sprintf&#40;nomtex,"%s.bmp",&#40;*objet&#41;.nom&#41;;
  
  
  fichier1 = fopen &#40; nomobj , "rb" &#41;;//essai d'ouvrir le fichier
  if &#40;fichier1!=NULL&#41;//si le fichier est ouvert
  &#123;
  
  while &#40;fgets&#40; ligne, 256, fichier1  &#41; != NULL&#41;//on le lit ligne par ligne
  &#123;
     switch &#40;ligne&#91;0&#93;&#41;//on va regarder le premier caractère 
           &#123;
         case 'v'&#58;//si c'est un V
         if&#40;ligne&#91;1&#93;==' '&#41; //c'est un vertice
         nb_vert++;
         
         if&#40;ligne&#91;1&#93;=='t'&#41; //c'est un texcoord
         nb_texc++;
         
         if&#40;ligne&#91;1&#93;=='n'&#41; //c'est une normale
         nb_norm++;         
         
         
         break;
         case 'f'&#58;//si c'est une face
         &#40;*objet&#41;.nb_face++;

         break;
         default&#58;
         
         break;
           &#125;
  
  
  
  &#125;
  
  //on a compté le nombre, now on aloue la memoire qu'il faut
  
     float *vertx = malloc&#40;nb_vert* sizeof&#40;float&#41;&#41;;
     float *verty = malloc&#40;nb_vert * sizeof&#40;float&#41;&#41;;
     float *vertz = malloc&#40;nb_vert * sizeof&#40;float&#41;&#41;;      
     
     float *texcx = malloc&#40;nb_texc * sizeof&#40;float&#41;&#41;;
     float *texcy = malloc&#40;nb_texc * sizeof&#40;float&#41;&#41;;

     float *normx = malloc&#40;nb_norm * sizeof&#40;float&#41;&#41;;
     float *normy = malloc&#40;nb_norm * sizeof&#40;float&#41;&#41;;
     float *normz = malloc&#40;nb_norm * sizeof&#40;float&#41;&#41;;
        

        
     int *facevert1 = malloc&#40;&#40;*objet&#41;.nb_face * sizeof&#40;int&#41;&#41;;
     int *facetexc1 = malloc&#40;&#40;*objet&#41;.nb_face * sizeof&#40;int&#41;&#41;;
     int *facenorm1 = malloc&#40;&#40;*objet&#41;.nb_face * sizeof&#40;int&#41;&#41;;
     int *facevert2 = malloc&#40;&#40;*objet&#41;.nb_face * sizeof&#40;int&#41;&#41;;
     int *facetexc2 = malloc&#40;&#40;*objet&#41;.nb_face * sizeof&#40;int&#41;&#41;;
     int *facenorm2 = malloc&#40;&#40;*objet&#41;.nb_face * sizeof&#40;int&#41;&#41;;
     int *facevert3 = malloc&#40;&#40;*objet&#41;.nb_face * sizeof&#40;int&#41;&#41;;
     int *facetexc3 = malloc&#40;&#40;*objet&#41;.nb_face * sizeof&#40;int&#41;&#41;;
     int *facenorm3 = malloc&#40;&#40;*objet&#41;.nb_face * sizeof&#40;int&#41;&#41;;
     
      
  
  rewind&#40;fichier1&#41;;//on rembobine le fichier au debut
  
  int v=0,vt=0,vn=0,f=0;
  
  while &#40;fgets&#40; ligne, 256, fichier1  &#41; != NULL&#41;//on le relit ligne par ligne
  &#123;
     switch &#40;ligne&#91;0&#93;&#41;//on va regarder le premier caractère 
           &#123;
         case 'v'&#58;//si c'est un V
         if&#40;ligne&#91;1&#93;==' '&#41; //c'est un vertice
	 &#123;
         if&#40; sscanf&#40; ligne + 2, "%f %f %f", vertx + v, verty + v, vertz + v &#41; == 3 &#41; 
                &#123;
		 v+=1;
		&#125;
	 &#125;
         
         if&#40;ligne&#91;1&#93;=='t'&#41; //c'est un texcoord
         &#123;
	  if&#40; sscanf&#40; ligne + 2, "%f %f", texcx + vt, texcy + vt &#41; == 2 &#41; 
                &#123;
		 vt+=1;
		&#125;
	 
	 &#125;
         
         if&#40;ligne&#91;1&#93;=='n'&#41; //c'est une normale
	 &#123;
	  if&#40; sscanf&#40; ligne + 2, "%f %f %f", normx + vn, normy + vn , normz + vn &#41; == 3 &#41; 
                &#123;
	         vn+=1;
		&#125;
	 &#125;
         
         
         break;
         case 'f'&#58;//si c'est une face
         if&#40; sscanf&#40; ligne + 2, "%d/%d/%d %d/%d/%d %d/%d/%d", facevert1+f, facetexc1+f , facenorm1+f, facevert2+f, facetexc2+f , facenorm2+f, facevert3 + f, facetexc3 + f , facenorm3 + f&#41; == 9 &#41; 
                 &#123;
                     f+=1;
                 &#125;

         break;
         default&#58;
         
         break;
           &#125;
  
  
  
  &#125;

  fclose &#40;fichier1&#41;;
  
  &#40;*objet&#41;.vertices = memalign&#40;24*&#40;*objet&#41;.nb_face*sizeof&#40;float&#41;,16&#41;;
  int i;
  for&#40;i=0;i<&#40;*objet&#41;.nb_face;i++&#41;
  &#123;
   int j;
    //pour le premier point
    j=facetexc1&#91;i&#93;-1;
    &#40;*objet&#41;.vertices&#91;24*i&#93; = texcx&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+1&#93; = texcy&#91;j&#93;;
    
    j=facenorm1&#91;i&#93;-1;
    &#40;*objet&#41;.vertices&#91;24*i+2&#93; = normx&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+3&#93; = normy&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+4&#93; = normz&#91;j&#93;;
    
    j=facevert1&#91;i&#93;-1;
    &#40;*objet&#41;.vertices&#91;24*i+5&#93; = vertx&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+6&#93; = verty&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+7&#93; = vertz&#91;j&#93;;
   //pour le deuxiemme point
    j=facetexc2&#91;i&#93;-1;
    &#40;*objet&#41;.vertices&#91;24*i+8&#93; = texcx&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+9&#93; = texcy&#91;j&#93;;
    
    j=facenorm2&#91;i&#93;-1;
    &#40;*objet&#41;.vertices&#91;24*i+10&#93; = normx&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+11&#93; = normy&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+12&#93; = normz&#91;j&#93;;
    
    j=facevert2&#91;i&#93;-1;
    &#40;*objet&#41;.vertices&#91;24*i+13&#93; = vertx&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+14&#93; = verty&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+15&#93; = vertz&#91;j&#93;;
   //pour le troisiemme point
    j=facetexc3&#91;i&#93;-1;
    &#40;*objet&#41;.vertices&#91;24*i+16&#93; = texcx&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+17&#93; = texcy&#91;j&#93;;
    
    j=facenorm3&#91;i&#93;-1;
    &#40;*objet&#41;.vertices&#91;24*i+18&#93; = normx&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+19&#93; = normy&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+20&#93; = normz&#91;j&#93;;
    
    j=facevert3&#91;i&#93;-1;
    &#40;*objet&#41;.vertices&#91;24*i+21&#93; = vertx&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+22&#93; = verty&#91;j&#93;;
    &#40;*objet&#41;.vertices&#91;24*i+23&#93; = vertz&#91;j&#93;;    
    
  &#125;

     
     free&#40;vertx&#41;;
     free&#40;verty&#41;;
     free&#40;vertz&#41;;
     
     free&#40;texcx&#41;;
     free&#40;texcy&#41;;

     free&#40;normx&#41;;
     free&#40;normy&#41;;
     free&#40;normz&#41;;
        

        
     free&#40;facevert1&#41;;
     free&#40;facetexc1&#41;;
     free&#40;facenorm1&#41;;
     free&#40;facevert2&#41;;
     free&#40;facetexc2&#41;;
     free&#40;facenorm2&#41;;
     free&#40;facevert3&#41;;
     free&#40;facetexc3&#41;;
     free&#40;facenorm3&#41;;
      
  
  
  
  
     &#125;
     else//sinon c'est que le fichier n'a pas pu etre ouvert
     &#123;
	return 0;//pspDebugScreenPrintf&#40;"Erreur le fichier n'a pu être ouvert"&#41;;
     &#125;
//fin du loader	
	valtest=&#40;*objet&#41;.vertices&#91;7&#93;;
	
//début du loader de bitmap


	
	FILE * fichier2;
	fichier2 = fopen &#40; nomtex , "rb" &#41;;//essai d'ouvrir le fichier
	if &#40;fichier2==NULL&#41;//si le fichier n'est ouvert
	return 0;
	
	
	
	fseek&#40;fichier2, 0x12, SEEK_SET&#41;;
	fread&#40;&&#40;&#40;*objet&#41;.largeur&#41;,sizeof&#40;int&#41;,1,fichier2&#41;;//largeur contient maintenant la largeur
	
        
	fseek&#40;fichier2, 0x16, SEEK_SET&#41;;
	fread&#40;&&#40;&#40;*objet&#41;.hauteur&#41;,sizeof&#40;int&#41;,1,fichier2&#41;;//largeur contient maintenant la largeur
	
        &#40;*objet&#41;.texture = memalign&#40;&#40;*objet&#41;.hauteur * &#40;*objet&#41;.largeur * 4 * sizeof&#40;float&#41;,16&#41;;
	valtest=&#40;*objet&#41;.vertices&#91;7&#93;;
	fseek&#40;fichier2, 0x36, SEEK_SET&#41;;
        int i=0;
        while&#40;i<&#40;*objet&#41;.hauteur*&#40;*objet&#41;.largeur*4&#41;
        &#123;
	    fread&#40;&#40;*objet&#41;.texture+i+2,sizeof&#40;char&#41;,1,fichier2&#41;;//lit l'information "rouge"
            i++;
            fread&#40;&#40;*objet&#41;.texture+i,sizeof&#40;char&#41;,1,fichier2&#41;;//lit l'information "vert"
            i++;
            fread&#40;&#40;*objet&#41;.texture+i-2,sizeof&#40;char&#41;,1,fichier2&#41;;//lit l'information "bleu"
            i++;
            &#40;*objet&#41;.texture&#91;i&#93;=0xFF;//pour l'alpha on met ça
            i++; 
        &#125;    
	&#40;*objet&#41;.etat=1;
	
	
	return 1;
&#125;

int dessineobj&#40;struct objet* objet&#41;
&#123;
		sceGumLoadIdentity&#40;&#41;;//locate and rotate
		&#123;
			ScePspFVector3 pos = &#123; &#40;*objet&#41;.x, &#40;*objet&#41;.y, &#40;*objet&#41;.z &#125;;
			ScePspFVector3 rot = &#123; &#40;*objet&#41;.xrot, &#40;*objet&#41;.yrot, &#40;*objet&#41;.zrot &#125;;
			sceGumTranslate&#40;&pos&#41;;
			sceGumRotateXYZ&#40;&rot&#41;;
			
		&#125;
 // setup texture

		sceGuTexMode&#40;GU_PSM_8888,0,0,0&#41;;
		sceGuTexImage&#40;0,&#40;*objet&#41;.largeur,&#40;*objet&#41;.hauteur,&#40;*objet&#41;.largeur,&#40;*objet&#41;.texture&#41;;
		sceGuTexFunc&#40;GU_TFX_MODULATE,GU_TCC_RGB&#41;;
		sceGuTexEnvColor&#40;0xffff00&#41;;
		sceGuTexFilter&#40;GU_LINEAR,GU_LINEAR&#41;;
		sceGuTexScale&#40;1.0f,1.0f&#41;;
		sceGuTexOffset&#40;0.0f,0.0f&#41;;
		sceGuAmbientColor&#40;0xffffffff&#41;;
		
		sceGuColor&#40;0xffffff&#41;;

		// dessine le mesh

		sceGumDrawArray&#40;GU_TRIANGLES,GU_TEXTURE_32BITF|GU_NORMAL_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_3D,&#40;*objet&#41;.nb_face*3,0,&#40;*objet&#41;.vertices&#41;;

	return 1;
&#125;

int dechargeobj&#40;struct objet* objet&#41;
&#123;
	free&#40;&#40;*objet&#41;.vertices&#41;;
	free&#40;&#40;*objet&#41;.texture&#41;;
	return 1;
&#125;
#define BUF_WIDTH &#40;512&#41;
#define SCR_WIDTH &#40;480&#41;
#define SCR_HEIGHT &#40;272&#41;

int main&#40;int argc, char* argv&#91;&#93;&#41;
&#123;
	setupCallbacks&#40;&#41;;
	SceCtrlData pad;

	
	pspDebugScreenInit&#40;&#41;;
	
	struct objet objetest;
	objetest.etat=0;
	sprintf&#40;objetest.nom,"test"&#41;;
	objetest.x=0;
	objetest.y=0;
	objetest.z=-2.5;
	objetest.xrot=0;
	objetest.yrot=0;
	objetest.zrot=0;
	chargeobj&#40;&objetest&#41;;
	

	sceGuInit&#40;&#41;;

	sceGuStart&#40;GU_DIRECT,list&#41;;
	sceGuDrawBuffer&#40;GU_PSM_8888,&#40;void*&#41;0,BUF_WIDTH&#41;;
	sceGuDispBuffer&#40;SCR_WIDTH,SCR_HEIGHT,&#40;void*&#41;&#40;4*BUF_WIDTH*SCR_HEIGHT&#41;,BUF_WIDTH&#41;;
	sceGuDepthBuffer&#40;&#40;void*&#41;&#40;8*BUF_WIDTH*SCR_HEIGHT&#41;,BUF_WIDTH&#41;;
	sceGuOffset&#40;2048 - &#40;SCR_WIDTH/2&#41;,2048 - &#40;SCR_HEIGHT/2&#41;&#41;;
	sceGuViewport&#40;2048,2048,SCR_WIDTH,SCR_HEIGHT&#41;;
	sceGuDepthRange&#40;65535,0&#41;;
	sceGuScissor&#40;0,0,SCR_WIDTH,SCR_HEIGHT&#41;;
	sceGuEnable&#40;GU_SCISSOR_TEST&#41;;
	sceGuDepthFunc&#40;GU_GEQUAL&#41;;
	sceGuEnable&#40;GU_DEPTH_TEST&#41;;
	sceGuFrontFace&#40;GU_CCW&#41;;
	sceGuShadeModel&#40;GU_SMOOTH&#41;;
	sceGuEnable&#40;GU_CULL_FACE&#41;;
	sceGuEnable&#40;GU_TEXTURE_2D&#41;;
	sceGuEnable&#40;GU_CLIP_PLANES&#41;;
	sceGuEnable&#40;GU_LIGHTING&#41;;
	sceGuEnable&#40;GU_LIGHT0&#41;;
	sceGuFinish&#40;&#41;;
	sceGuSync&#40;0,0&#41;;

	sceDisplayWaitVblankStart&#40;&#41;;
	sceGuDisplay&#40;GU_TRUE&#41;;


	
	
	float x=0,y=0,z=0,xrot=0,yrot=0,zrot=0;
	
	while&#40;running&#40;&#41;&#41;
	&#123;
		pspDebugScreenSetXY&#40;0, 1&#41;;
		pspDebugScreenPrintf&#40;"test 3 &#58; commandes"&#41;;
		
		pspDebugScreenSetXY&#40;0, 2&#41;;
		int T;
		for&#40;T=0;T<8;T++&#41;
		&#123;
		pspDebugScreenPrintf&#40;"%f,",objetest.vertices&#91;T&#93;&#41;;
		&#125;
		
		pspDebugScreenSetXY&#40;0, 4&#41;;
		pspDebugScreenPrintf&#40;"val &#58;%f",valtest&#41;;
		
		sceCtrlReadBufferPositive&#40;&pad, 1&#41;;
		
			if &#40;pad.Buttons & PSP_CTRL_UP&#41;&#123;
			x+=-sin&#40;yrot&#41;*.1;
			z+=cos&#40;yrot&#41;*.1;
			&#125; 
			if &#40;pad.Buttons & PSP_CTRL_DOWN&#41;&#123;
			x-=-sin&#40;yrot&#41;*.1;
			z-=cos&#40;yrot&#41;*.1;
			&#125; 
			if &#40;pad.Buttons & PSP_CTRL_LEFT&#41;&#123;
				yrot-=.1;
			&#125; 
			if &#40;pad.Buttons & PSP_CTRL_RIGHT&#41;&#123;
				yrot+=.1;
			&#125;
		
		sceGuStart&#40;GU_DIRECT,list&#41;;



		sceGuClearColor&#40;0xff554433&#41;;
		sceGuClearDepth&#40;0&#41;;
		sceGuClear&#40;GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT&#41;;

		

		ScePspFVector3 pos = &#123; 0, 1, 0 &#125;;
			sceGuLight&#40;0,GU_DIRECTIONAL,GU_DIFFUSE_AND_SPECULAR,&pos&#41;;
			sceGuLightColor&#40;0,GU_DIFFUSE,0x88888888&#41;;
			sceGuLightColor&#40;0,GU_SPECULAR,0xffffffff&#41;;
			sceGuLightAtt&#40;0,0.0f,1.0f,0.0f&#41;;
			
		sceGuSpecular&#40;12.0f&#41;;
		sceGuAmbient&#40;0x00222222&#41;;
		
		


		sceGumMatrixMode&#40;GU_PROJECTION&#41;;
		sceGumLoadIdentity&#40;&#41;;
		sceGumPerspective&#40;75.0f,16.0f/9.0f,0.5f,1000.0f&#41;;

		sceGumMatrixMode&#40;GU_VIEW&#41;;
		sceGumLoadIdentity&#40;&#41;;
		&#123;
			ScePspFVector3 pos = &#123; x, y, z &#125;;
			ScePspFVector3 rot = &#123; xrot, yrot,zrot &#125;;
			
			sceGumRotateXYZ&#40;&rot&#41;;
			sceGumTranslate&#40;&pos&#41;;
		&#125;
		
		sceGumMatrixMode&#40;GU_MODEL&#41;;
		
		dessineobj&#40;&objetest&#41;;

		

		sceGuFinish&#40;&#41;;
		sceGuSync&#40;0,0&#41;;

		sceDisplayWaitVblankStart&#40;&#41;;
		sceGuSwapBuffers&#40;&#41;;

		
	&#125;
	dechargeobj&#40;&objetest&#41;;
	sceGuTerm&#40;&#41;;

	sceKernelExitGame&#40;&#41;;
	return 0;
&#125;
if you can help me
i think I missed something really big but i don"t now what
ector
Posts: 195
Joined: Thu May 12, 2005 10:22 pm

Post by ector »

Hey, you're using memalign backwards! The blockalign parameter (16) should be first.

That should explain most of your problems :)

Of course, there could be more problems, I didn't spend a lot of time reading your code.
http://www.dtek.chalmers.se/~tronic/PSPTexTool.zip Free texture converter for PSP with source. More to come.
skwi
Posts: 22
Joined: Tue May 16, 2006 4:28 am

Post by skwi »

oh thank you, this solve all my problems
now it's working fine (but i think i'll find another problem later)
thank you for your help
Post Reply