I try to render some 2d images on the side screen. The problem is however that only one of my images is shown and only after the second loop :S
So the first loop only shows the 3d model, the second loop shows only the 3d model and the second sprite.
here is my loop:
Code: Select all
int NumberOfObjects = 4;
MeshD Objects[NumberOfObjects];
int color[NumberOfObjects];
float MaxDistance = 150;
float distance;
int i;
sprintf(sBuffer, "Objects/box.obj");
sprintf(sBufferB, "Objects/box.mtl");
LoadObjectTriangles(sBuffer,sBufferB, &Objects[0]);
sprintf(sBuffer, "Objects/cone.obj");
sprintf(sBufferB, "Objects/cone.mtl");
LoadObjectTriangles(sBuffer,sBufferB, &Objects[1]);
sprintf(sBuffer, "Objects/sphere.obj");
sprintf(sBufferB, "Objects/sphere.mtl");
LoadObjectTriangles(sBuffer,sBufferB, &Objects[2]);
sprintf(sBuffer, "Objects/complex.obj");
sprintf(sBufferB, "Objects/complex.mtl");
LoadObjectTriangles(sBuffer,sBufferB, &Objects[3]);
for(i=0;i<NumberOfObjects;i++){
distance = MaxDistance;
while(1){
//misc.
distance -= 0.1f;
//controls
SceCtrlData pad;
sceCtrlReadBufferPositive(&pad, 1);
if (pad.Buttons != 0){
if (pad.Buttons & PSP_CTRL_CROSS){
// do next
if (iButtonX == FALSE){
iButtonX = TRUE;
break;
}
}
}
else {
iButtonX = FALSE;
}
//render
sceGuStart(GU_DIRECT,list);
sceGuClearColor(0xff000000);
sceGuClearDepth(0);
sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
matrix_identity((float*)&projection);
matrix_projection((float*)&projection,75.0f,16.0f/9.0f,4.0,1000.0f);
sceGuSetMatrix(GU_PROJECTION,&projection);
matrix_identity((float*)&view);
matrix_rotate((float*)&view, 0, 3.15f, 0);
matrix_translate((float*)&view,0, 0, 0);
sceGuSetMatrix(GU_VIEW,&view);
// set the ambient light
// sceGuAmbient(0x00ffffff);
RenderObjectTriangles(&Objects[i], 0, 0, distance, 0);
Punt Hoekie[2];
Hoekie[0].x = 0.0f;
Hoekie[0].y = 0.0f;
Hoekie[0].u = 0.0f;
Hoekie[0].v = 0.0f;
Hoekie[1].x = 90.0f;
Hoekie[1].y = 90.0f;
Hoekie[1].u = 1.0f;
Hoekie[1].v = 1.0f;
sceGuTexImage(0, Choice[0]->textureWidth, Choice[0]->textureHeight, Choice[0]->textureWidth, (void*)Choice[0]->data);
sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,Hoekie);
Hoekie[0].x = 0.0f;
Hoekie[0].y = 90.0f;
Hoekie[0].u = 0.0f;
Hoekie[0].v = 0.0f;
Hoekie[1].x = 90.0f;
Hoekie[1].y = 180.0f;
Hoekie[1].u = 1.0f;
Hoekie[1].v = 1.0f;
sceGuTexImage(0, Choice[1]->textureWidth, Choice[1]->textureHeight, Choice[1]->textureWidth, (void*)Choice[1]->data);
sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,Hoekie);
//blitImageToScreen(0 ,0 ,90 , 90, Choice[0], 0, 0);
//blitImageToScreen(0 ,0 ,90 , 90, Choice[1], 0, 91);
//blitImageToScreen(0 ,0 ,90 , 90, Choice[2], 0, 182);
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuSwapBuffers();
}
}
}
What i want it to do is show everything the first time the loop begins and everytime in the loop any ideas or suggestions?
greets ghoti
P.S. ohw and for some reason the texture which is fully red, shows gradient when rendered