![]() |
|
|
|
#1
|
||||
|
||||
|
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);
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)));
}
}
__________________
----------------------------------------- View my current project's Progress Here |
|
#2
|
||||
|
||||
|
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/ |
|
#4
|
|||
|
|||
|
:-/ ... 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:
Last thing : DONT USE DOUBLEzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zz.Just floats,,,,....,,,,. |
|
#5
|
||||
|
||||
|
Quote:
Thanks for helping me once again Brick . So reliable!
__________________
----------------------------------------- View my current project's Progress Here |
|
#6
|
||||
|
||||
|
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); What is going on here? Edit: Nevermind... it only slowed down that much on my emulator Spoiler: 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. |
|
#7
|
||||
|
||||
|
Far far far FAR from a noob! Brick just does what he does
__________________
|
|
#8
|
|||
|
|||
|
Quote:
Spoiler: Quote:
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. |
|
#9
|
||||
|
||||
|
you can decrease fps by using "sceDisplayWaitVblankStart()" at the end of your loop (if its causing problems)
|
|
#10
|
|||
|
|||
|
Quote:
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). |
![]() |
|
|
|||
|
|||
|
|
| Thread Tools | |
| Display Modes | |
|
|