You are not logged in.
I'll try to explain this problem using my poor English:
I have implemented a console to display a log of communication messages. I erase the screen using this function:
void Console::clearScreen() { if (!consoleMode) return; mutexLock(); GRRLIB_FillScreen(GRRLIB_NAVY); GRRLIB_PrintfTTF(console_minimum_x,console_minimum_y,myFont,"press B button to exit from console mode ",getFontSize(),GRRLIB_YELLOW); xConsola = console_minimum_x; yConsola = console_minimum_y+getFontSize()+1; GRRLIB_Screen2Texture(0,0,copyConsole,false); setRender(true); mutexUnlock(); }
And I write on the screen usign this function:
void Console::print(const char* str,const u32 color) { if (!consoleMode) return; mutexLock(); // restore previous screen GRRLIB_DrawImg(0,0,copyConsole,0,1,1,GRRLIB_WHITE); char str[200]; strncpy(str,str,200); unsigned previous = 0; for (unsigned i=0; i<strlen(str); i++) if (str[i]=='\n') { str[i] = '\0'; GRRLIB_PrintfTTF(xConsole,yConsole,myFont,str+previous,getFontSize(),color); previous = i+1; xConsole=Console_minimum_x; yConsole+=getFontSize()+1; } if (strlen(str) != previous) { GRRLIB_PrintfTTF(xConsole,yConsole,myFont,str+previous,getFontSize(),color); // ignore multiline strings xConsole+=GRRLIB_WidthTTF(getFont(),str+previous,getFontSize()); if (xConsole>=(unsigned)rmode->fbWidth-50) { xConsole=Console_minimum_x; yConsole+=getFontSize()+1; } } // clear screen instead scrolling if (yConsole>=rmode->xfbHeight) //yConsole=Console_minimum_y+getFontSize()+1; clearScreen(); // copy screen content GRRLIB_Screen2Texture(0,0,copyConsole,false); setRender(true); mutexUnlock(); }
Well, a communications thread uses these functions to write text on the screen and if console mode is cancelled then the main() function takes the control of the screen. Mutexes are used to let main() function call to GRRLIB_Render() when something is waiting to be displayed on the screen.
The problem is that after every GRRLIB_DrawImg() call the text on the screen gets corrupted, even the background of color GRRLIB_NAVY gets darker, and the text on the top of the screen is more corrupted that in the middle, the last displayed text is almost perfect.
I have no idea about what happens, thanks in advance.
Offline
hi,
i bet your GRRLIB_Settings.antialias is true try setting it to false, and tell me.
NNN
Offline
The problem continues using this code:
GRRLIB_Init(); GRRLIB_SetAntiAliasing(false);
Is there any way to change this setting ?
Last edited by chatuser (2010-09-10 16:33:48)
Offline
This is a screenshot showing the problem:
The image gets more corrupted every time GRRLIB_Render() is called.
Last edited by chatuser (2010-09-10 20:03:01)
Offline
Don't ask me how, I have changed the order of some GRRLIB functions calls and now it works as expected, I think there is some "magical" combination of operations that causes this problem, but now it has been solved.
Offline
chatuser wrote:
Don't ask me how, I have changed the order of some GRRLIB functions calls and now it works as expected, I think there is some "magical" combination of operations that causes this problem, but now it has been solved.
If it's possible we would appreciate to see your modifications. Thanks.
Offline
Sorry for answering late, I have reordered and simplified the code, but after of tons of tests I can't say what exactly solved the problem.
I have removed the mutexes and reduced the number of GRRLIB_Render() calls, I suspect that mutexes and interlaced GRRLIB_Render() calls fouled up the program logic.
Offline