Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [a5] filtering primitives for offscreen bitmaps?

This thread is locked; no one can reply to it. rss feed Print
[a5] filtering primitives for offscreen bitmaps?
Mark Oates
Member #1,146
March 2001
avatar

Hey again. :P

When drawing primitives to a bitmap other than the backbuffer, the multisampling fails. In this example, I've drawn a line to the backbuffer (on the left), and also drawn it to an offscreen bitmap (right)

#SelectExpand
1ALLEGRO_BITMAP *offscreen_render; 2 3// initialize code 4 5offscreen_render = al_create_bitmap(200, 150); 6 7// in the draw code 8 9 al_set_target_bitmap(offscreen_render); 10 al_clear_to_color(color("light green")); 11 al_draw_line(10, 120, 190, 100, color("red"), 3); 12 13 al_set_target_bitmap(al_get_backbuffer()); 14 al_draw_line(10, 120, 190, 100, color("red"), 3); 15 16 al_draw_bitmap(offscreen_render, 200, NULL);

Produces:
{"name":"601549","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/4\/d489f234eb978a284c3b80a3ca50963f.png","w":442,"h":217,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/4\/d489f234eb978a284c3b80a3ca50963f"}601549

I tried adding the al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP) before creating the bitmap to be sure, but it didn't change anything. My idea for a workaround is to prerender onto the backbuffer and draw from there to intended prerender location. This doesn't seem ideal but it could work.

[edit] oops, topic should be "[a5] multisampling primitives for offscreen bitmaps?"

[edit] I've tried drawing with the backbuffer to another surface but it won't permit it. The console outputs 'fail'. :P

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Elias
Member #358
May 2000

Yes, multi-sampling is only supported on the display backbuffer so far (with OpenGL at least).

I wouldn't know how to enable multi-sampling for an FBO. If there's some simple OpenGL setting for it we should enable it.

Otherwise, need a patch to implement it.

Do you know if it works with DirectX?

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

Milan Mimica
Member #3,877
September 2003
avatar

Elias
Member #358
May 2000

Quote:

No method is provided for creating multisample texture images.

Since we only support drawing into bitmaps (textures) and have no actual "off-screen" buffers, does this mean we cannot use it?

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

Mark Oates
Member #1,146
March 2001
avatar

Elias said:

Do you know if it works with DirectX?

No. It does not work with DirectX.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Go to: