Re: [AD] exnew_drawpixels.c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2008-08-13, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> On 2008-08-12, Milan Mimica <milan.mimica@xxxxxxxxxx> wrote:
> > Peter Wang wrote:
> > > 
> > > Confirmed on a different machine.  The machine on which the examples
> > > fail doesn't support FBOs, so there's something wrong with that.
> > 
> > Hm, it still works even if I make Allegro stop using FBOs.
> > You can try WGL under wine by calling al_set_new_display_flags(ALLEGRO_OPENGL).
> 
> Unfortunately I run into unimplemented wine territory:
> 
> fixme:wgl:X11DRV_wglGetPixelFormatAttribivARB unsupported 2007 WGL Attribute
> fixme:wgl:X11DRV_wglGetPixelFormatAttribivARB unsupported 2016 WGL Attribute
> fixme:wgl:X11DRV_wglGetPixelFormatAttribivARB unsupported 2018 WGL Attribute
> ..
> 
> The d3d versions all work.  I'll try to debug it tonight.

This fixes exnew_bitmap_target, exnew_blend, exnew_membmp and a5teroids.
Does it make any sense?

The exnew_drawpixels problem is different.

Peter


diff --git a/src/opengl/ogl_bitmap.c b/src/opengl/ogl_bitmap.c
index 8d0fc28..51329b2 100644
--- a/src/opengl/ogl_bitmap.c
+++ b/src/opengl/ogl_bitmap.c
@@ -368,6 +368,7 @@ static void ogl_unlock_region(ALLEGRO_BITMAP *bitmap)
    ALLEGRO_BITMAP_OGL *ogl_bitmap = (void *)bitmap;
    const int pixel_size = al_get_pixel_size(bitmap->format);
    const int pitch = bitmap->pitch; 
+   GLboolean on;
 
    if (bitmap->lock_flags & ALLEGRO_LOCK_READONLY)
       return;
@@ -401,6 +402,10 @@ static void ogl_unlock_region(ALLEGRO_BITMAP *bitmap)
       glPixelStorei(GL_UNPACK_ROW_LENGTH, unpack_row_length);
    }
    else {
+      glGetBooleanv(GL_TEXTURE_2D, &on);
+      if (!on)
+         glEnable(GL_TEXTURE_2D);
+
       // FIXME: don't copy the whole bitmap
       glBindTexture(GL_TEXTURE_2D, ogl_bitmap->texture);
       /* We don't copy anything past bitmap->h on purpose. */






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/