sceGuStart Question

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
dega
Posts: 14
Joined: Tue Oct 24, 2006 1:22 pm

sceGuStart Question

Post by dega »

This is probably a very n00bish question but I can't figure it out. I am just starting out with the graphics API that comes with the PSP SDK and I am struggling with understanding what a few of the functions do (there is only so much the comments in the header files can tell you), in this case it's sceGuStart. Let me show the code before I ask my questions:

Code: Select all

// headers

#define ALIGNED __attribute__((aligned(16)))

static unsigned int ALIGNED list[262144];
static bool running = true;

// all of my other global variables, callbacks, etc...

int main(int argc, char *argv[])
{
      // variables, init code etc...
      
      while (running)
      {
            sceGuStart(GU_DIRECT, list);      // CONFUSING, ARRRGGGG
            
            // actually do the rendering here
      }
      
      // all of my de-init code
      
      return 0;
}
Ok, so my questions are:
  • What is sceGuStart for?
  • Why GU_DIRECT?
  • Why does sceGuStart need 'list' (and why is list the size it is)?
Am I making this way too complicated or is this similar to OpenGL display lists?

Thanks a ton :) !
- dega
swordman
Posts: 27
Joined: Tue Dec 27, 2005 9:04 pm

Post by swordman »

Hi, I'm studing the graphics function too.
The sceGuStart function anable the hardware rendering (I think.)
The list parameter is a place in memory that willl be used by GU function to store it's internal commands and calculatio0n results. GU use it on its own.
It's like the ogl display list.
Can't remember chat GU_DIRECT is, sorry.
User avatar
dega
Posts: 14
Joined: Tue Oct 24, 2006 1:22 pm

Post by dega »

Thanks for the reply!

Since my post I have learned some more about sceGuStart. Like you said, it is for display lists. From what I understand, the reason that a list is needed for any rendering is because the GU library needs it for all of its internal processing. As for GU_DIRECT, it causes any instructions/data in the list to be processed immediately (unlike something like GU_CALL, which builds the list to be later called with sceGuCallList). Also, the size of the list can pretty much be anything - the only rule is that it must be at least the size that sceGuFinish (since it returns the size of the data put into the list) would return after all of the rendering code.
adrahil
Posts: 274
Joined: Thu Mar 16, 2006 1:55 am

Post by adrahil »

The size of the list is width*height*2, to some extent :P (it actually looks like the nearest power of 2 to that number...) Why that? Only the gods know ;)
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

The list is that size because I deemed it a good size that could be filled with a lot of data when I wrote the samples. You can set it to whatever size you want. Read the documentation generated from pspgu.h (or read pspgu.h directly), and read the samples.
GE Dominator
Post Reply