|
Flickering border artifacts when using "al_set_clipping_rectangle" |
David Couzelis
Member #10,079
August 2008
|
I have my video game display coded so that "ALLEGRO_FULLSCREEN_WINDOW" mode will do the largest integer scale possible, then use "al_set_clipping_rectangle" to preserve the aspect ratio. I expect the "borders" of the clipping rectangle to be black, but instead, they flicker with what looks like screen artifacts. (See attachments) Here is an excerpt from my display code: 1al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW);
2
3/* Initialize the one and only global display for the game */
4display = al_create_display(width * scale, height * scale);
5
6al_clear_to_color(al_map_rgb(0, 0, 0));
7
8/* Scale and center the display as big as possible on this screen */
9set_display_transform(scale, offset_x, offset_y, fullscreen);
10
11/* Crop the drawing area, to not accidentally draw in the black borders */
12al_set_clipping_rectangle(offset_x, offset_y, display_width * scale, display_height * scale);
Full code here: https://github.com/drcouzelis/colorwandcastle/blob/master/src/display.c Is there something I can do to prevent the seizure-inducing flickering around the display area? My computer: |
Chris Katko
Member #1,881
January 2002
|
Did you forget the attachment? -----sig: |
David Couzelis
Member #10,079
August 2008
|
Haha Here are the attachments. |
Elias
Member #358
May 2000
|
Can you post the source code of set_display_transform? Also note that the parameters to al_create_display are ignored when you use ALLEGRO_FULLSCREEN_WINDOW. -- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I can't say what you're doing for sure, but it sounds like you're leaving video memory uninitialized, with undefined contents. Are you clearing the screen? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
David Couzelis
Member #10,079
August 2008
|
Elias said: Can you post the source code of set_display_transform? The full code is here: https://github.com/drcouzelis/colorwandcastle/blob/master/src/display.c Here it is again, for convenience: 1static void set_display_transform(int scale, float offset_x, float offset_y, bool fullscreen)
2{
3 ALLEGRO_TRANSFORM trans;
4
5 /* Confirm that the display has been created */
6 assert(al_get_target_bitmap());
7
8 /**
9 * Scale the coordinates to match the actual size of the display.
10 * It will be performed on the current target bitmap.
11 */
12 al_identity_transform(&trans);
13 al_scale_transform(&trans, scale, scale);
14 if (fullscreen) {
15 al_translate_transform(&trans, offset_x, offset_y);
16 }
17 al_use_transform(&trans);
18}
Edgar Reynaldo said: Are you clearing the screen? I think so... 1al_clear_to_color(al_map_rgb(0, 0, 0));
2draw(data); /* DRAW */
3al_flip_display();
4redraw = false;
Full source: https://github.com/drcouzelis/colorwandcastle/blob/master/src/run.c |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Bumping this thread so it doesn't get lost. Can you provide a minimal working (failing) example that does this? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|