roland
Joined: 11 Feb 2006 Posts: 13
|
Posted: Sun Apr 30, 2006 11:01 pm Post subject: sceGuGetMemory Question |
|
|
Hi
I was wondering if anyone here could help me..
I am trying to draw 40x22 Faces on the Screen and I can not get it to work.. It works fine with 32x18 and I strongly think I am simply having Memory allocation Problems:
| Code: |
#define FACE_MAX_W 40
#define FACE_MAX_H 22
typedef struct Vertex_Color
{
unsigned int color;
float x,y,z;
} Vertex_Color;
face_horizGridStep = FACE_MAX_W;
face_vertiGridStep = FACE_MAX_H;
int res_horizStep = SCR_WIDTH/face_horizGridStep;
int res_vertiStep = SCR_HEIGHT/face_vertiGridStep;
Vertex_Color * faces = (struct Vertex_Color*)sceGuGetMemory(face_horizGridStep*face_vertiGridStep*6*sizeof(Vertex_Color));
// Build the grid
int counter = 0;
int intcnt = 0;
for (x = 0; x < face_horizGridStep; x++)
{
for (y = 0; y < face_vertiGridStep; y++)
{
faces[counter].color = GU_ABGR(0xff,0,0,0);
faces[counter].x = (x * res_horizStep)+(intensity_map[intcnt]/4);
faces[counter].y = (y * res_vertiStep)+(intensity_map[intcnt]/4);
faces[counter++].z = 0;
faces[counter].color = GU_ABGR(0xff,0,0,0);
faces[counter].x = ((x + 1) * res_horizStep)-(intensity_map[intcnt]/4);
faces[counter].y = (y * res_vertiStep)+(intensity_map[intcnt]/4);
faces[counter++].z = 0;
faces[counter].color = GU_ABGR(0xff,0,0,0);
faces[counter].x = (x * res_horizStep)+(intensity_map[intcnt]/4);
faces[counter].y = ((y + 1) * res_vertiStep)-(intensity_map[intcnt]/4);
faces[counter++].z = 0;
faces[counter].color = GU_ABGR(0xff,0,0,0);
faces[counter].x = ((x + 1) * res_horizStep)-(intensity_map[intcnt]/4);
faces[counter].y = (y * res_vertiStep)+(intensity_map[intcnt]/4);
faces[counter++].z = 0;
faces[counter].color = GU_ABGR(0xff,0,0,0);
faces[counter].x = ((x + 1) * res_horizStep)-(intensity_map[intcnt]/4);
faces[counter].y = ((y + 1) * res_vertiStep)-(intensity_map[intcnt]/4);
faces[counter++].z = 0;
faces[counter].color = GU_ABGR(0xff,0,0,0);
faces[counter].x = (x * res_horizStep)+(intensity_map[intcnt]/4);
faces[counter].y = ((y +1) * res_vertiStep)-(intensity_map[intcnt]/4);
faces[counter++].z = 0;
intcnt++;
}
}
sceGumDrawArray(GU_TRIANGLES,GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_2D,counter,0,faces);
|
sceGuGetMemory in this case is allocting 40*22*6*16 = 84480 Bytes which should by ok right?!?
The Max List Size (if that is of any concern here, I am quite unsure!) is the usual with 262144 (from the Samples)..
is sceGuGetMemory allocating in VRAM or standard RAM? How much is there to allocate and what's the maximum that can be done!?
Your help is greatly appreciated
Roland |
|