PSP Hacks - Forums

Go Back   PSP Hacks - Forums > PSP Community > PSP Programming & Development

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 10-20-2009, 04:49 PM
Stinkee2's Avatar
Stinkee2 Stinkee2 is offline
Programmer
PSP Smarty
 

Join Date: Jul 2009
Location: int main()
Posts: 190
Stinkee2 is on a distinguished road
Default GU Help

could anybody tell me which of these Line drawing methods are faster?

Using sceGuDrawArray()
Code:
sceGuStart(GU_DIRECT,list);
        sceGuDisable(GU_TEXTURE_2D);
        sceGuDisable(GU_DEPTH_TEST);
        lineVertex* Line = (lineVertex*)sceGuGetMemory(2 * sizeof(lineVertex));
        Line[0].color = color;
        Line[0].x = V1->X;
        Line[0].y = V1->Y;
        Line[0].z = 0.0f;
        Line[1].color = color;
        Line[1].x = V2->X;
        Line[1].y = V2->Y;
        Line[1].z = 0.0f;
        sceGuDrawArray(GU_LINES, GU_COLOR_8888 | GU_VERTEX_32BITF | GU_TRANSFORM_2D, 2, 0, Line);
        sceGuEnable(GU_DEPTH_TEST);
        sceGuEnable(GU_TEXTURE_2D);
        sceGuFinish();
        sceGuSync(0,0);
using Single Pixel Drawing Function
Code:
bool yLonger = false;
	    int incrementVal;
	    int shortLen = V2->Y - V1->Y;
	    int longLen = V2->X - V1->X;
	    if(abs(shortLen)>abs(longLen))
	    {
    		int swap=shortLen;
	    	shortLen=longLen;
		    longLen=swap;
		    yLonger=true;
	    }
	    if(longLen < 0)
	    {
	        incrementVal = -1;
	    }
	    else
	    {
            incrementVal = 1;
	    }
	    double divDiff;
	    if(shortLen == 0)
        {
            divDiff = longLen;
        }
	    else
	    {
	        divDiff = (double)longLen / (double)shortLen;
	    }
	    if(yLonger)
	    {
		    for (int i=0;i!=longLen;i+=incrementVal)
		    {
    			DPixel(color,Vect(V1->X+(int)((double)i/divDiff),V1->Y+i));
		    }
	    }
	    else
	    {
    		for(int i=0;i!=longLen;i+=incrementVal)
		    {
    			DPixel(color,Vect(V1->X+i,V1->Y+(int)((double)i/divDiff)));
		    }
	    }
also, I Cant get that first method to draw a filled Rectangle using GU_SPRITES, The rectangle just shows up black??
__________________
-----------------------------------------
View my current project's Progress Here
Reply With Quote
  #2  
Old 10-21-2009, 08:57 AM
PSdonkey's Avatar
PSdonkey PSdonkey is offline
Lop-sided Testicule Admin
PSP Titan
 

Join Date: Dec 2005
Posts: 9,406
PSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond repute
Default

Brick is going to rip you apart
__________________
Want to become a PSP Dev the easy way? Check out my tutorial for the PSP here http://www.psp-hacks.com/forums/f141...orial-t152466/
Want to learn how to create your own games on the PSP? Check out my tutorial here http://www.psp-hacks.com/forums/f141...-your-t153653/
Want to learn how to program C++ ? Check out that tutorial here http://www.psp-hacks.com/forums/f124...ram-c-t122337/
Reply With Quote
  #3  
Old 10-21-2009, 05:48 PM
Stinkee2's Avatar
Stinkee2 Stinkee2 is offline
Programmer
PSP Smarty
 

Join Date: Jul 2009
Location: int main()
Posts: 190
Stinkee2 is on a distinguished road
Default

Why? What did I do? Is it because Im a Noob?
__________________
-----------------------------------------
View my current project's Progress Here
Reply With Quote
  #4  
Old 10-21-2009, 09:35 PM
Brick Brick is offline
I am Flame Master
PSP Titan
 

Join Date: Mar 2005
Location: *this
Posts: 42,229
Brick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond repute
Default

Quote:
Originally Posted by Stinkee2 View Post
Why? What did I do? Is it because Im a Noob?
:-/ ... Donkey is just joking , unless you really believe that that's my role here [ /fp ].

Now , back to your "question" , isn't it just obvious that the first method is faster? Not to mention that
you use doubles and loops-over-loops(that putPixel method must be doing what i have in mind probably).

AND , it seems that you have no idea on how to enable/disable render states. You're doing everything the wrong way.
You disable something only if you don't need it , then you enable it back if it was needed by a previous task.

PSP isn't really for beginners , unless : 1) You pick an existing and easy to use library(oslib...for example)
2) You don't care that much to actually LEARN...


Quote:
also, I Cant get that first method to draw a filled Rectangle using GU_SPRITES, The rectangle just shows up black??
Probably you dont bind any texture(if you use any) or a color.



Last thing : DONT USE DOUBLEzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zz.Just floats,,,,....,,,,.
Reply With Quote
  #5  
Old 10-21-2009, 09:43 PM
Stinkee2's Avatar
Stinkee2 Stinkee2 is offline
Programmer
PSP Smarty
 

Join Date: Jul 2009
Location: int main()
Posts: 190
Stinkee2 is on a distinguished road
Default

Quote:
Originally Posted by Brick View Post
Last thing : DONT USE DOUBLEzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zz.Just floats,,,,....,,,,.
I didnt make that second method, I got it from a code snippet. but carelessly forgot to revise it (other than changing some stuff for compatability).

Thanks for helping me once again Brick . So reliable!
__________________
-----------------------------------------
View my current project's Progress Here
Reply With Quote
  #6  
Old 10-23-2009, 06:14 PM
Stinkee2's Avatar
Stinkee2 Stinkee2 is offline
Programmer
PSP Smarty
 

Join Date: Jul 2009
Location: int main()
Posts: 190
Stinkee2 is on a distinguished road
Default

Im having one more problem now though...

Code:
sceGuStart(GU_DIRECT, list);
sceGuClearColor(color);
sceGuClearDepth(0);
sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
sceGuFinish();
sceGuSync(0,0);
that lowers the frame rate by like 30 frames!
What is going on here?

Edit:

Nevermind... it only slowed down that much on my emulator

Spoiler:
Quote:
Originally Posted by Brick
Well , from what i can see , if that isn't running over 150fps , then you have an issue.
Quote came from This Post

just implemented FPS counter (Env->GetFPS()) and I was very suprised to see that I get 350+ FPS! heres a screenshot:




unfortunately, I get an unhandled exception after 2000 or so frames... .
EDIT Again:
just changed the way physics are calculated & some other graphics stuff now I get 500+fps .
now if only I could figure out why its crashing .
__________________
-----------------------------------------
View my current project's Progress Here

Last edited by Stinkee2; 10-26-2009 at 10:09 PM.
Reply With Quote
  #7  
Old 10-21-2009, 09:23 PM
Masteroid's Avatar
Masteroid Masteroid is offline
PSP Enthusiast
 

Join Date: May 2009
Location: Aotearoa
Posts: 450
Masteroid , I'd like to see things from your point of view but I can't seem to get my head that far up my assMasteroid , I'd like to see things from your point of view but I can't seem to get my head that far up my assMasteroid , I'd like to see things from your point of view but I can't seem to get my head that far up my assMasteroid , I'd like to see things from your point of view but I can't seem to get my head that far up my assMasteroid , I'd like to see things from your point of view but I can't seem to get my head that far up my assMasteroid , I'd like to see things from your point of view but I can't seem to get my head that far up my assMasteroid , I'd like to see things from your point of view but I can't seem to get my head that far up my assMasteroid , I'd like to see things from your point of view but I can't seem to get my head that far up my assMasteroid , I'd like to see things from your point of view but I can't seem to get my head that far up my assMasteroid , I'd like to see things from your point of view but I can't seem to get my head that far up my assMasteroid , I'd like to see things from your point of view but I can't seem to get my head that far up my ass
Default

Far far far FAR from a noob! Brick just does what he does
__________________
Reply With Quote
  #8  
Old 10-29-2009, 09:08 AM
Brick Brick is offline
I am Flame Master
PSP Titan
 

Join Date: Mar 2005
Location: *this
Posts: 42,229
Brick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond repute
Default

Quote:
Nevermind... it only slowed down that much on my emulator
Spoiler:

!!!!!!!!!!!!!!!!!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@FLAME@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



Quote:
now if only I could figure out why its crashing .
Judging by your latest source release , obviously you have more
memory leaks in your code and/or null pointers/accessing array elements out of range...

...You can use psplink , and addr2line to get the exact line(S) that cause this if you're having hard time tracking it.

The first thing you can try is to remove the debug text just to make sure that you have fixed the c-string leaks.

You're on your own now... :-)

Last edited by Brick; 10-29-2009 at 09:11 AM.
Reply With Quote
  #9  
Old 10-29-2009, 11:26 AM
MTN's Avatar
MTN MTN is offline
Programmer
PSP Hacks Member
 
Join Date: Jan 2009
Location: ...
Posts: 272
MTN Has a Beginner Reputation
Default

you can decrease fps by using "sceDisplayWaitVblankStart()" at the end of your loop (if its causing problems)
Reply With Quote
  #10  
Old 11-02-2009, 12:05 AM
Brick Brick is offline
I am Flame Master
PSP Titan
 

Join Date: Mar 2005
Location: *this
Posts: 42,229
Brick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond repute
Default

Quote:
Originally Posted by MTN View Post
you can decrease fps by using "sceDisplayWaitVblankStart()" at the end of your loop (if its causing problems)

You do not need to limit fps. In the end , you'll get : + (fm = 4k/500fps) * (fmd = 500fps/60fps).
Just fix the issue and never limit the frames.
All you need is simple fdp-based movement(without accumulators/step iterators and stuff).
Reply With Quote
Reply

 



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:08 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©