Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Ho to use multi sampling ?

This thread is locked; no one can reply to it. rss feed Print
Ho to use multi sampling ?
Soporythmique
Member #14,537
September 2012

Hello,

(Sorry for my bad english)

I'm having trouble with the multi-sampling, I know that this function il enabled by default, but when I try this:

#SelectExpand
1al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST); 2 al_set_new_display_option(ALLEGRO_SAMPLES, 8, ALLEGRO_SUGGEST); 3 if (al_get_display_option(Affichage, ALLEGRO_SAMPLE_BUFFERS)) 4 { 5 printf("With multisampling, level %i\n", al_get_display_option(Affichage, ALLEGRO_SAMPLES)); 6 } 7 else 8 { 9 printf("Without multisampling.\n"); 10 }

It return "Without multisampling" . . .
I draw on a bitmap, and then draw that bitmap on the screen like I saw on a tutorial:

#SelectExpand
1al_set_target_bitmap(Buffer); 2 al_clear_to_color(al_map_rgb(0, 0, 0)); 3al_draw_line(x1, y1, x2, y2, al_map_rgb(255, 120, 120), 0); 4 al_set_target_bitmap(al_get_backbuffer(Affichage)); 5 al_draw_scaled_bitmap(Buffer, 0, 0, LargeurAffichage, HauteurAffichage, 0, 0, 1920, 1080, 0);

So I don't know where is the problem . . .

Thanks for your help

PS: My graphic crad is a 520M

Trent Gamblin
Member #261
April 2000
avatar

1) I think you have to be drawing onto the display for multisampling to work (but I could be wrong!)

2) According to your code you're setting those display options (SAMPLE_BUFFERS, SAMPLES) after you already have a display. You have to set the before you create a display.

Soporythmique
Member #14,537
September 2012

According to your code you're setting those display options (SAMPLE_BUFFERS, SAMPLES) after you already have a display. You have to set the before you create a display.

2

Thank you it was just that, I thought it was activated by default.

Just a last question, I didn't understound the utility of drawing on a bitmap for then draw this bitmap on the screen . . . it use twice more time no ?

Currently I draw directly on the screen, and it work perfectly.

Elias
Member #358
May 2000

Multisampling only works when drawing directly to the display.

(We could add multisampling for offscreen targets if someone needs it and wants to implement it, for example by using this extension: http://www.khronos.org/registry/gles/extensions/EXT/EXT_multisampled_render_to_texture.txt

Either just enabling it for all video bitmaps if the display has multi-sampling or adding a new bitmap flag would work API-wise I think.)

--
"Either help out or stop whining" - Evert

Trent Gamblin
Member #261
April 2000
avatar

Enable it with a display bitmap flag out of those two options. Otherwise there's no way to get a non-multisampled bitmap if you have a multi-sampled display. I'm sure there's a use case.

Go to: