hi everybody, I want to make a game using primitives only. for that, I want to enable multisampling and antialiase diagonal lines and circles. I've searched on the forum for this and found this thread thread/603894 . below is the code in which I've tried to enable multisampling but I cannot see any effect of it.
please guide me what should I do to get multisampling enabled .
I just want smooth antialiased primitives drawn on the screen .
Call al_set_new_display_option before creating the display.
Is it possible to create transparent or translucent primitives using allegro 5. I want to create Translucent rectangles so that if one rectangle go behind another, both can be visible .
Yes, it is possible. Pass a premultiplied alpha color as the color to the drawing routines :
float r = 1.0f; float g = 0.75f; float b = 0.5f; float a = 0.5f; al_draw_line(x,y,x2,y2,al_map_rgba_f(r*a , g*a , b*a , a),25.0); al_flip_display();
@Matthew Leverton : as shown below now I am calling al_set_new_display_option before creating display but still I can't see any difference. I am also checking if the option is set or not with al_get_display_option and it is returning 0. please help me out !!
Use ALLEGRO_SUGGEST instead of ALLEGRO_REQUIRE, in case the exact value of 8 samples is not supported by your hardware (it might only support 4 or 10 or 16 or something). With suggest it will use the closest available one.
the problem is solved many thanks to you all ..
First i had to set the options before creating the display.Second, I had to set the importance to ALLEGRO_SUGGEST so that if requested sampling value is not available allegro will set the closest available.
here is how the final code looks like