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 

pspgl & pspDebugScreenPrintf()

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



Joined: 17 Oct 2008
Posts: 43

PostPosted: Fri Oct 30, 2009 1:04 am    Post subject: pspgl & pspDebugScreenPrintf() Reply with quote

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:

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;
}
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Fri Oct 30, 2009 1:50 am    Post subject: Reply with quote

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



Joined: 17 Oct 2008
Posts: 43

PostPosted: Fri Oct 30, 2009 2:12 am    Post subject: Reply with quote

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



Joined: 28 May 2008
Posts: 842

PostPosted: Fri Oct 30, 2009 2:50 am    Post subject: Reply with quote

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



Joined: 17 Oct 2008
Posts: 43

PostPosted: Fri Oct 30, 2009 9:38 pm    Post subject: Reply with quote

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



Joined: 17 Oct 2008
Posts: 43

PostPosted: Mon Nov 02, 2009 3:35 am    Post subject: Reply with quote

A problem with lines overlapping is resolved with:

Code:

pspDebugScreenSetMaxX(32);
pspDebugScreenSetMaxY(17);


This two functions available in the rev 2487 of the pspsdk.

But the problem with font stretching still remain.
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