pspgl & pspDebugScreenPrintf()

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

Moderators: cheriff, TyRaNiD

Post Reply
lego
Posts: 43
Joined: Fri Oct 17, 2008 1:09 am

pspgl & pspDebugScreenPrintf()

Post by lego »

Hi, all.

It's strange, but using pspgl I don't see pspDebugScreenPrintf() output on the screen or an output is very strange (big symbols, overlaped lines).

Code: Select all

void initgl(void)
{
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(0.0, 480, 272, 0, -1, 1);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();

  glViewport(0, 0, 480, 272);

  glClearColor(0.0, 0.0, 0.0, 0.0);
}

int main(void)
{
  SDL_Surface *scrn;


  SetupCallbacks();
  pspDebugScreenInit();


  if ( SDL_Init(SDL_INIT_VIDEO) ) {
    fprintf(stderr, "Error: %s\n", SDL_GetError());
    return 1;
  }
  atexit(SDL_Quit);


  if ( !(scrn = SDL_SetVideoMode(480, 272, 32, SDL_OPENGL)) ) {
    fprintf(stderr, "Set video Error: %s\n", SDL_GetError());
    return 2;
  }

  initgl();

  glClear(GL_COLOR_BUFFER_BIT);

  printf("This message is displayed very very strange.");

  sceKernelSleepThreadCB();

  return 0;
}
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Debug blits to the active framebuffer. If the buffers have been swapped by something else (or display mode changed etc.), you need to reinit debug screen so it blits with the current display settings.
lego
Posts: 43
Joined: Fri Oct 17, 2008 1:09 am

Post by lego »

Torch wrote:Debug blits to the active framebuffer. If the buffers have been swapped by something else (or display mode changed etc.), you need to reinit debug screen so it blits with the current display settings.
Thanks! This works.

But how I can use smaller font? Text, which is too long for one line, overlap on the one line instead of printing on next lines. How can I resolve this issue?
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

lego wrote:But how I can use smaller font? Text, which is too long for one line, overlap on the one line instead of printing on next lines. How can I resolve this issue?
You'll need to recompile it after creating a new "font" image with the size you require and editing the font width & height in the debug library source. The "font" file is just a RAW image that contains the ASCII characters. Try importing it as 8888 ARGB data in GIMP.

All the characters have a fixed width (8 pixels?). Just write a simple wrapper function to split it into multiple printf calls depending on the number of characters that fit (60 ?).
lego
Posts: 43
Joined: Fri Oct 17, 2008 1:09 am

Post by lego »

Torch wrote:
lego wrote:But how I can use smaller font? Text, which is too long for one line, overlap on the one line instead of printing on next lines. How can I resolve this issue?
You'll need to recompile it after creating a new "font" image with the size you require and editing the font width & height in the debug library source. The "font" file is just a RAW image that contains the ASCII characters. Try importing it as 8888 ARGB data in GIMP.

All the characters have a fixed width (8 pixels?). Just write a simple wrapper function to split it into multiple printf calls depending on the number of characters that fit (60 ?).
Thanks. I will try to do this.

But why does sceDebugScreenPrintf() work fine with SDL and sceGu, claiming at the same time this manipulations with pspgl?
lego
Posts: 43
Joined: Fri Oct 17, 2008 1:09 am

Post by lego »

A problem with lines overlapping is resolved with:

Code: Select all

pspDebugScreenSetMaxX(32);
pspDebugScreenSetMaxY(17);
This two functions available in the rev 2487 of the pspsdk.

But the problem with font stretching still remain.
Post Reply