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 

PSP gu library. Drawing Lines

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



Joined: 15 Sep 2005
Posts: 32

PostPosted: Fri Sep 23, 2005 1:42 am    Post subject: PSP gu library. Drawing Lines Reply with quote

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!!!!
Back to top
View user's profile Send private message
BlackDragon777



Joined: 15 Sep 2005
Posts: 32

PostPosted: Fri Sep 23, 2005 1:48 am    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
BlackDragon777



Joined: 15 Sep 2005
Posts: 32

PostPosted: Fri Sep 23, 2005 11:33 am    Post subject: Reply with quote

Nevermind. I got it now. Thanks anyways though!
Back to top
View user's profile Send private message
BlackDragon777



Joined: 15 Sep 2005
Posts: 32

PostPosted: Fri Sep 23, 2005 2:13 pm    Post subject: Reply with quote

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:

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!
Back to top
View user's profile Send private message
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Fri Sep 23, 2005 4:10 pm    Post subject: Reply with quote

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

Code:

typedef struct
{
  float x,y,z;
} point2D;


Otherwise it'll read the vertices improperly.
_________________
GE Dominator
Back to top
View user's profile Send private message
ector



Joined: 12 May 2005
Posts: 195

PostPosted: Sat Sep 24, 2005 3:49 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Sat Sep 24, 2005 4:06 am    Post subject: Reply with quote

sceGuGetMemory() has always "uncached" the pointer. Users just keep forgetting it when they aren't using that function. :)
_________________
GE Dominator
Back to top
View user's profile Send private message
BlackDragon777



Joined: 15 Sep 2005
Posts: 32

PostPosted: Sat Sep 24, 2005 6:49 am    Post subject: Reply with quote

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

my point2D structure looked like so,

Code:

typedef struct
{
    int x,y;

} point2D;



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

Code:

typedef struct
{
    float x,y,z;

} point2D;


Thanks for all the help everyone!
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