Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Allegro5 and Awesomium

This thread is locked; no one can reply to it. rss feed Print
Allegro5 and Awesomium
komons
Member #11,083
June 2009

How to render Awesomium buffer to Allegro5? It must work as quickly as it's possible.

Buffer is a unsigned char* with BGRA format.

SiegeLord
Member #7,827
October 2006
avatar

EDIT: My bad. What I said before was incorrect...

A5 doesn't have BGRA format, as far as I can see. This would be the way to do it:

  1. Create a video bitmap

  2. Lock it (with ALLEGRO_LOCK_WRITEONLY and a set pixel format) and manually copy the data to it while converting to RGBA

  3. Unlock it and draw it somewhere

EDIT2: Well, this post is turning into a megafail, heh.

Another approach (if you don't particularly care about doing any fancy effects) would be to lock the backbuffer directly instead of using an intermediate bitmap. I don't know which way is faster.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

komons
Member #11,083
June 2009

It work better. But both are too slow.

SiegeLord
Member #7,827
October 2006
avatar

How much time is spent converting between the color formats? Do you get any speedups if you simply memcpy the Awesomium buffer into the locked buffer?

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

komons
Member #11,083
June 2009

I have another idea. What you think about shader program?
Program which get pixels-buffer data and draw it into bitmap by GPU.

SiegeLord
Member #7,827
October 2006
avatar

That is what I was getting at. Doing only the uploading on the CPU, but then using a shader to convert RGBA to BGRA.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: