Re: [AD] correct behaviour for additive blending? |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Sat, 2010-03-13 at 17:30 +1100, Peter Wang wrote:
> On 2010-03-13, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> >
> > I'll try it on a couple of other machines around here.
>
> Ok, I couldn't reproduce the problem on a machine with the old open source
> ATI driver, nor on a machine with the proprietary Nvidia driver. So it's
> probably specific to fglrx or maybe the configuration on that machine.
>
Can you try this? It should also be wrong if the problem is in the
driver and not A5.
#include "allegro5/allegro5.h"
#include "allegro5/allegro_opengl.h"
struct V {
float x, y;
unsigned char r, g, b, a;
};
int main()
{
ALLEGRO_DISPLAY *display;
ALLEGRO_EVENT_QUEUE *queue;
al_init();
display = al_create_display(640, 480);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnable(GL_BLEND);
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
struct V v[] = {
{100, 150, 0, 50, 0, 255},
{200, 150, 0, 50, 0, 255},
{150, 100, 0, 50, 0, 255},
{150, 200, 0, 50, 0, 255},
};
glBlendFuncSeparate(GL_ONE, GL_ONE, GL_ONE, GL_ONE);
glBlendEquation(GL_FUNC_ADD);
glVertexPointer(2, GL_FLOAT, sizeof(struct V), &v[0].x);
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(struct V), &v[0].r);
glDrawArrays(GL_LINES, 0, 4);
al_flip_display();
queue = al_create_event_queue();
al_register_event_source(queue, al_get_display_event_source(display));
while (1) {
ALLEGRO_EVENT event;
al_wait_for_event(queue, &event);
if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
break;
}
return 0;
}