Re: [AD] locking problem on OpenGL |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2009-08-15, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> In ex_bitmap.c if I comment out al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
> and load a JPEG image then the output comes out wrong. It looks like it
> is expecting 4-channel data and only getting 3-channels. I'm pretty
> sure the JPEG loader is correct. It works with memory bitmaps and D3D
> under Wine. I tracked this down as far as the glTexSubImage2D() calls
> in ogl_unlock_region. The bug only occurs with ALLEGRO_LOCK_WRITEONLY.
I found that I needed to change the GL_UNPACK_ALIGNMENT before the call
to glTexSubImage2D() at ogl_bitmap.c:717.
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
otherwise it expects the start of each row of pixels to be word-aligned.
Or should we change ogl_lock_region to account for the alignment in the
first place?
Peter