PSP gu library. Drawing Lines

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

Moderators: cheriff, TyRaNiD

Post Reply
BlackDragon777
Posts: 32
Joined: Thu Sep 15, 2005 8:26 am

PSP gu library. Drawing Lines

Post by BlackDragon777 »

So where can I read the documentation on the gu library. Also how to I draw lines using the hardware. Are there some tutorials? I checked out the Lines smaple in the pspsdk however I didn't quite follow it. I don't know exactly what all the commands do. Can someone point me in the right direction please? Thanks!


GOD Bless you Always!!!!
BlackDragon777
Posts: 32
Joined: Thu Sep 15, 2005 8:26 am

Post by BlackDragon777 »

Also when I say I want to draw lines using the hardware, I mean I want to do it similar to the way you do it on a PS2. I don't want to use software by using a function that plots pixels on a line. I want to send a simple graphics packet to the gs in the PSP and have it draw the line for me. Any ideas where I can get more info on this? Thanks!
BlackDragon777
Posts: 32
Joined: Thu Sep 15, 2005 8:26 am

Post by BlackDragon777 »

Nevermind. I got it now. Thanks anyways though!
BlackDragon777
Posts: 32
Joined: Thu Sep 15, 2005 8:26 am

Post by BlackDragon777 »

Well I can draw triangles. However I can't seem to draw lines afterall.

This is how I setup my code for drawing lines.

Code: Select all

Points = (point2D *)sceGuGetMemory(sizeof(point2D)*2);

Points[0].x = 10;
Points[0].y = 11;
Points[1].x = 100;
Points[1].y = 110;

sceGuDrawArray(GU_LINES, GU_VERTEX_32BITF | GU_TRANSFORM_2D, 2, 0, Points);
However I don't see a line on the screen. Is there something wrong with the way I arrange my points in memory? Thanks!
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

Even though you bypass the transform, you need to specify a Z-component. So I hope your structure looks like this:

Code: Select all

typedef struct
{
  float x,y,z;
} point2D;
Otherwise it'll read the vertices improperly.
GE Dominator
ector
Posts: 195
Joined: Thu May 12, 2005 10:22 pm

Post by ector »

Also, remember to flush the cache or to "uncache" the pointer.. or does sceGuGetMemory do that nowadays?
http://www.dtek.chalmers.se/~tronic/PSPTexTool.zip Free texture converter for PSP with source. More to come.
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

sceGuGetMemory() has always "uncached" the pointer. Users just keep forgetting it when they aren't using that function. :)
GE Dominator
BlackDragon777
Posts: 32
Joined: Thu Sep 15, 2005 8:26 am

Post by BlackDragon777 »

Well just for reference incase anyone else encounters my same problem,

my point2D structure looked like so,

Code: Select all

typedef struct
{
    int x,y;

} point2D;

When in actuality, like chp suggested, it should look like so,

Code: Select all

typedef struct
{
    float x,y,z;

} point2D;
Thanks for all the help everyone!
Post Reply