paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/src/draw/opengl glpriv.hh,1.1.2.2,1.1.2.3 pgg


From: Teunis Peters <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/draw/opengl glpriv.hh,1.1.2.2,1.1.2.3 pgglcore.cpp,1.1.2.6,1.1.2.7 pggloper.cpp,1.1.2.7,1.1.2.8
Date: Fri, 17 Jan 2003 18:13:10 -0500

Update of /cvsroot/paragui/paragui/src/draw/opengl
In directory subversions:/tmp/cvs-serv9717/src/draw/opengl

Modified Files:
      Tag: devel-opengl
        glpriv.hh pgglcore.cpp pggloper.cpp 
Log Message:
just some small updates.  More later.


Index: glpriv.hh
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/glpriv.hh,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** glpriv.hh   31 Oct 2002 10:38:04 -0000      1.1.2.2
--- glpriv.hh   17 Jan 2003 23:13:08 -0000      1.1.2.3
***************
*** 17,20 ****
--- 17,27 ----
  namespace PG_Draw {
  
+ /* Not all OpenGL implementations support texture extensions - even with
+  * OpenGL 1.2 where they are standard rather than an extension.
+  * This is kind of a pity.  So at this point I'm making them an optional
+  * feature.  As DirectX DOES have palette textures this code will be of some
+  * use eventually there too.
+  */
+ /* #undef USE_PALETTE_TEXTURES */
  /*
   * Note that this will result in whining about

Index: pgglcore.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/pgglcore.cpp,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -r1.1.2.6 -r1.1.2.7
*** pgglcore.cpp        9 Nov 2002 12:00:35 -0000       1.1.2.6
--- pgglcore.cpp        17 Jan 2003 23:13:08 -0000      1.1.2.7
***************
*** 141,162 ****
    pf = surface->format;
    if (pf->BitsPerPixel == 1) goto pass; /* binary always passes... it's a 
native OpenGL format */
    if (pf->BitsPerPixel == 8) goto pass; /* Palette formats are also native... 
*/
!   if ((pf->BitsPerPixel == 16) && (pf->Amask) && (!pf->Bmask)) goto pass; /* 
LA - OpenGL native */
  
    /* Colorkeying requires an alpha channel! */
    if (surface->flags & SDL_SRCCOLORKEY)
      if (!pf->Amask) goto fail;
!   
    /* We need pitch == (width * BytesPerPixel) for glTex[Sub]Image2D() */
!   if (surface->pitch != (surface->w * pf->BytesPerPixel)) goto fail;
    
!   if (pf->Amask) {
      // PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x", 
__FUNCTION__, __FILE__, __LINE__, _RGBAfmt.BytesPerPixel, _RGBAfmt.Rmask, 
_RGBAfmt.Gmask, _RGBAfmt.Bmask, _RGBAfmt.Amask);
      // PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x", 
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask, 
pf->Bmask, pf->Amask);
      if (pf->BytesPerPixel != _RGBAfmt.BytesPerPixel) goto fail;
      if (pf->Rmask != _RGBAfmt.Rmask) goto fail;
      if (pf->Gmask != _RGBAfmt.Gmask) goto fail;
      if (pf->Bmask != _RGBAfmt.Bmask) goto fail;
      if (pf->Amask != _RGBAfmt.Amask) goto fail;
      // PG_LogMSG("%s[%s:%i]: OK", __FUNCTION__, __FILE__, __LINE__);
    } else {
--- 141,173 ----
    pf = surface->format;
    if (pf->BitsPerPixel == 1) goto pass; /* binary always passes... it's a 
native OpenGL format */
+ #ifdef USE_PALETTE_TEXTURES
    if (pf->BitsPerPixel == 8) goto pass; /* Palette formats are also native... 
*/
! #endif
  
    /* Colorkeying requires an alpha channel! */
    if (surface->flags & SDL_SRCCOLORKEY)
      if (!pf->Amask) goto fail;
! 
! #if 0 /* FIXED *grin* -- add in support for alignment... */  
    /* We need pitch == (width * BytesPerPixel) for glTex[Sub]Image2D() */
!   if (surface->pitch != (surface->w * pf->BytesPerPixel)) {
!     PG_LogMSG("%s[%s:%i]: pitch %i w %i", __FUNCTION__, __FILE__, __LINE__, 
surface->pitch, surface->w);
!     goto fail;
!   };
! #endif
! 
!   if ((pf->BitsPerPixel == 16) && (pf->Amask) && (!pf->Bmask)) goto pass; /* 
LA - OpenGL native */
    
!   /* if (pf->Amask) { */
!   if (pf->BitsPerPixel == _RGBAfmt.BitsPerPixel) {
      // PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x", 
__FUNCTION__, __FILE__, __LINE__, _RGBAfmt.BytesPerPixel, _RGBAfmt.Rmask, 
_RGBAfmt.Gmask, _RGBAfmt.Bmask, _RGBAfmt.Amask);
      // PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x", 
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask, 
pf->Bmask, pf->Amask);
      if (pf->BytesPerPixel != _RGBAfmt.BytesPerPixel) goto fail;
+ #ifndef GL_VERSION_1_2
      if (pf->Rmask != _RGBAfmt.Rmask) goto fail;
      if (pf->Gmask != _RGBAfmt.Gmask) goto fail;
      if (pf->Bmask != _RGBAfmt.Bmask) goto fail;
      if (pf->Amask != _RGBAfmt.Amask) goto fail;
+ #endif
      // PG_LogMSG("%s[%s:%i]: OK", __FUNCTION__, __FILE__, __LINE__);
    } else {
***************
*** 164,170 ****
--- 175,183 ----
      // PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x", 
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask, 
pf->Bmask);
      if (pf->BytesPerPixel != _RGBfmt.BytesPerPixel) goto fail;
+ #ifndef GL_VERSION_1_2
      if (pf->Rmask != _RGBfmt.Rmask) goto fail;
      if (pf->Gmask != _RGBfmt.Gmask) goto fail;
      if (pf->Bmask != _RGBfmt.Bmask) goto fail;
+ #endif
    }
  
***************
*** 175,179 ****
    PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x", 
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask, 
pf->Bmask, pf->Amask);
    PG_LogMSG("%s[%s:%i]: RGBA format bpp %i rmask %x gmask %x bmask %x amask 
%x", __FUNCTION__, __FILE__, __LINE__, _RGBAfmt.BytesPerPixel, _RGBAfmt.Rmask, 
_RGBAfmt.Gmask, _RGBAfmt.Bmask, _RGBAfmt.Amask);
!   PG_LogMSG("%s[%s:%i]: RGB format bpp %i rmask %x gmask %x bmask %x amask 
%x", __FUNCTION__, __FILE__, __LINE__, _RGBAfmt.BytesPerPixel, _RGBfmt.Rmask, 
_RGBfmt.Gmask, _RGBfmt.Bmask, _RGBfmt.Amask);
    return 0;
  }
--- 188,192 ----
    PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x", 
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask, 
pf->Bmask, pf->Amask);
    PG_LogMSG("%s[%s:%i]: RGBA format bpp %i rmask %x gmask %x bmask %x amask 
%x", __FUNCTION__, __FILE__, __LINE__, _RGBAfmt.BytesPerPixel, _RGBAfmt.Rmask, 
_RGBAfmt.Gmask, _RGBAfmt.Bmask, _RGBAfmt.Amask);
!   PG_LogMSG("%s[%s:%i]: RGB format bpp %i rmask %x gmask %x bmask %x amask 
%x", __FUNCTION__, __FILE__, __LINE__, _RGBfmt.BytesPerPixel, _RGBfmt.Rmask, 
_RGBfmt.Gmask, _RGBfmt.Bmask, _RGBfmt.Amask);
    return 0;
  }
***************
*** 189,193 ****
        for(x = 0; x < surface->w; ++x)
        if(px[x] == ckey)
!         px[x] = 0;
      }
    SDL_UnlockSurface(surface);
--- 202,206 ----
        for(x = 0; x < surface->w; ++x)
        if(px[x] == ckey)
!         px[x] = 0x00ff00ff;
      }
    SDL_UnlockSurface(surface);
***************
*** 347,352 ****
      /* should I retain alpha if hasalpha is false??? */
      int use_rgba = (src->flags & SDL_SRCCOLORKEY) ||
!       ((src->flags & SDL_SRCALPHA) &&
!        src->format->Amask);
      if (use_rgba || hasalpha)
        tmp = SDL_ConvertSurface(src, &_RGBAfmt, SDL_SWSURFACE);
--- 360,364 ----
      /* should I retain alpha if hasalpha is false??? */
      int use_rgba = (src->flags & SDL_SRCCOLORKEY) ||
!       ((src->flags & SDL_SRCALPHA) && src->format->Amask);
      if (use_rgba || hasalpha)
        tmp = SDL_ConvertSurface(src, &_RGBAfmt, SDL_SWSURFACE);
***************
*** 430,435 ****
    talph = ((surf->GetSDLFlags() & SDL_SRCALPHA) ||
           (surf->GetSDLFlags() & SDL_SRCCOLORKEY) ||
!          surf->GetFormat()->Amask) || true;
!   // PG_LogMSG("create accelerated surface from SDL(alpha=%s)", 
talph?"true":"false");
  #endif
    ts = dynamic_cast<PG_GLDrawableSurface*>(AccelerateSurface(surf, talph));
--- 442,447 ----
    talph = ((surf->GetSDLFlags() & SDL_SRCALPHA) ||
           (surf->GetSDLFlags() & SDL_SRCCOLORKEY) ||
!          surf->GetFormat()->Amask);
!   PG_LogMSG("create accelerated surface from SDL(alpha=%s)", 
talph?"true":"false");
  #endif
    ts = dynamic_cast<PG_GLDrawableSurface*>(AccelerateSurface(surf, talph));
***************
*** 536,540 ****
      tmp_pal[i].g = i;
      tmp_pal[i].b = i;
!     tmp_pal[i].unused = 0xff; /* set alpha... as it IS respected */
    }
    surf->SetPalette(SDL_LOGPAL, tmp_pal, 0, 256);
--- 548,552 ----
      tmp_pal[i].g = i;
      tmp_pal[i].b = i;
!     tmp_pal[i].unused = 0; /* set alpha... as it IS respected to 0 */
    }
    surf->SetPalette(SDL_LOGPAL, tmp_pal, 0, 256);

Index: pggloper.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/pggloper.cpp,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -r1.1.2.7 -r1.1.2.8
*** pggloper.cpp        9 Nov 2002 12:00:35 -0000       1.1.2.7
--- pggloper.cpp        17 Jan 2003 23:13:08 -0000      1.1.2.8
***************
*** 394,398 ****
    dx2 += dx1;
    dy2 += dy1;
!   
    /*
     * Note that we actually *prevent* the use of "full surface alpha"
--- 394,399 ----
    dx2 += dx1;
    dy2 += dy1;
! 
! #if 0 /* disabled this block - it doesn't make sense anymore */  
    /*
     * Note that we actually *prevent* the use of "full surface alpha"
***************
*** 404,407 ****
--- 405,414 ----
    else
      alpha = 255;
+ #else
+   if (src->GetSDLFlags() & (SDL_SRCALPHA | SDL_SRCCOLORKEY))
+     alpha = src->GetFormat()->alpha;
+   else
+     alpha = 255;
+ #endif
    
    /* Render! */
***************
*** 434,443 ****
  int PG_GLDraw::_DownloadTexture(PG_GLDrawableSurface* datasurf,
                                glSDL_TexInfo *txi, int tex) {
!   SDL_Color refpal[256];
    enum { _None=0, _Bitmap=1, _Pal=2, _GreyAlpha=3, _RGBx=4 } surftype = _None;
    int bpp;
!   Uint32 rowlength, pitch, dw, dh;
    SDL_PixelFormat *pf;
    Uint8* pixels;
    pf    = datasurf->GetFormat();
    bpp   = pf->BytesPerPixel;
--- 441,458 ----
  int PG_GLDraw::_DownloadTexture(PG_GLDrawableSurface* datasurf,
                                glSDL_TexInfo *txi, int tex) {
! #if 0 // def GL_VERSION_1_2
!   GLushort refpal[4][256];
! #else
!   GLubyte refpal[256][4];
! #endif
    enum { _None=0, _Bitmap=1, _Pal=2, _GreyAlpha=3, _RGBx=4 } surftype = _None;
    int bpp;
!   Uint32 rowlength, pitch, dw, dh, dalign;
    SDL_PixelFormat *pf;
    Uint8* pixels;
+   GLint tinternalFormat;
+   GLenum tformat;
+   GLenum ttype;
+ 
    pf    = datasurf->GetFormat();
    bpp   = pf->BytesPerPixel;
***************
*** 479,522 ****
    };
  
- 
    if (surftype == _None) return -2;
    if (surftype == _Bitmap) {
      rowlength = pitch;
    } else {
      rowlength = pitch / bpp;
    };
    // PG_LogDBG("ParaGUI[%s]: %s:%i pitch %i bpp %i", __FILE__, __FUNCTION__, 
__LINE__, pitch, bpp);
    glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
!   
    switch (surftype) {
    case _None: return -2;
    case _Bitmap: {
!     glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, txi->texsize, txi->texsize, 
0, GL_LUMINANCE,
!                GL_BITMAP, NULL);
!     DBG(_print_glerror(2));
      break;
    };
    case _Pal: {
      int       ncolors;
-     SDL_Color *colors;
      ncolors = pf->palette->ncolors;
-     colors  = pf->palette->colors;
-     if (ncolors < 256) {
-       colors = refpal;
-       memcpy(colors, pf->palette->colors, pf->palette->ncolors);
-     };
  #ifdef GL_VERSION_1_2
      if (pf->palette != NULL) {
        // PG_LogDBG("ParaGUI[%s]: %s:%i pal[%i]:%p", __FILE__, __FUNCTION__, 
__LINE__, pf->palette->ncolors, pf->palette->colors);
!       glColorTable(GL_TEXTURE_2D,GL_RGBA8,   256,
!                  GL_RGBA,GL_UNSIGNED_BYTE, colors);
        DBG(_print_glerror(301));
!       glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT,
!                  txi->texsize, txi->texsize, 0, GL_COLOR_INDEX,
!                  GL_UNSIGNED_BYTE, NULL);
        DBG(_print_glerror(302));
-       glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
        break;
      };
--- 494,577 ----
    };
  
    if (surftype == _None) return -2;
+   dalign = 1;
    if (surftype == _Bitmap) {
      rowlength = pitch;
    } else {
      rowlength = pitch / bpp;
+     dalign    = (pitch % bpp) + 1;
    };
    // PG_LogDBG("ParaGUI[%s]: %s:%i pitch %i bpp %i", __FILE__, __FUNCTION__, 
__LINE__, pitch, bpp);
+   if (surftype != _Bitmap) {
+     glPixelStorei(GL_UNPACK_ALIGNMENT, dalign);
+   };
    glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
! 
!   tinternalFormat = GL_RGB8;
!   tformat = GL_RGB;
!   ttype = GL_UNSIGNED_BYTE;
! 
! 
!   tinternalFormat = GL_RGB8;
!   tformat = GL_RGB;
!   ttype = GL_UNSIGNED_BYTE;
! 
    switch (surftype) {
    case _None: return -2;
    case _Bitmap: {
!     PG_LogMSG("Bitmap size %ix%i",txi->texsize, txi->texsize);
!     tinternalFormat = GL_LUMINANCE;
!     tformat = GL_LUMINANCE;
!     ttype = GL_BITMAP;
      break;
    };
    case _Pal: {
+ #ifdef USE_PALETTE_TEXTURES
      int       ncolors;
      ncolors = pf->palette->ncolors;
  #ifdef GL_VERSION_1_2
      if (pf->palette != NULL) {
+ #if 0
+       for (int ck = 0; ck < ncolors; ck++) {
+       SDL_Color* c = pf->palette->colors + ck;
+       refpal[0][ck] = c->r;
+       refpal[1][ck] = c->g;
+       refpal[2][ck] = c->b;
+       refpal[3][ck] = c->unused;
+       };
+ #else
+       for (int ck = 0; ck < ncolors; ck++) {
+       SDL_Color* c = pf->palette->colors + ck;
+       refpal[ck][0] = 0xff - c->r;
+       refpal[ck][1] = 0xff; // - c->g;
+       refpal[ck][2] = 0xff;// - c->b;
+       refpal[ck][3] = 0; // xff - c->unused;
+       };
+ #endif
+       // PG_LogMSG("Pal size %ix%i",txi->texsize, txi->texsize);
        // PG_LogDBG("ParaGUI[%s]: %s:%i pal[%i]:%p", __FILE__, __FUNCTION__, 
__LINE__, pf->palette->ncolors, pf->palette->colors);
! #if 1
!       // glColorTableEXT(GL_TEXTURE_2D,GL_RGBA,   256,
!       //            GL_RGBA,GL_UNSIGNED_BYTE, refpal);
!       // glColorTable(GL_TEXTURE_2D,GL_RGBA,   256,
!       //              GL_RGBA,GL_UNSIGNED_BYTE, refpal);
! #else
!       glPixelTransferi(GL_MAP_COLOR, GL_TRUE);
!       glPixelMapusv(GL_PIXEL_MAP_I_TO_R, 256, refpal[0]);
!       glPixelMapusv(GL_PIXEL_MAP_I_TO_G, 256, refpal[1]);
!       glPixelMapusv(GL_PIXEL_MAP_I_TO_B, 256, refpal[2]);
!       glPixelMapusv(GL_PIXEL_MAP_I_TO_A, 256, refpal[3]);
! #endif
        DBG(_print_glerror(301));
! #ifdef GL_EXT_paletted_texture
!       tinternalFormat = GL_COLOR_INDEX8_EXT;
! #else
!       tinternalFormat = 1;
! #endif
!       tformat = GL_COLOR_INDEX;
!       // glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
        DBG(_print_glerror(302));
        break;
      };
***************
*** 524,561 ****
  #ifdef GL_EXT_paletted_texture
      if (pf->palette != NULL) {
        glColorTableEXT(GL_TEXTURE_2D,GL_RGBA,    256,
!                     GL_RGBA,GL_UNSIGNED_BYTE, colors);
!       glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT,
!                  txi->texsize, txi->texsize, 0, GL_COLOR_INDEX,
!                  GL_UNSIGNED_BYTE, NULL);
        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-       DBG(_print_glerror(4));
        break;
      };
  #endif
  #endif
!     glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8,
!                txi->texsize, txi->texsize, 0, GL_LUMINANCE,
!                GL_UNSIGNED_BYTE, NULL);
      DBG(_print_glerror(5));
      break;
    };
    case _GreyAlpha: {
!     glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8_ALPHA8,
!                txi->texsize, txi->texsize, 0, GL_LUMINANCE_ALPHA,
!                GL_UNSIGNED_BYTE, NULL);
      DBG(_print_glerror(6));
      break;
    };
    case _RGBx: {
!     glTexImage2D(GL_TEXTURE_2D, 0,
!                pf->Amask ? GL_RGBA8 : GL_RGB8,
!                txi->texsize, txi->texsize, 0,
!                pf->Amask ? GL_RGBA : GL_RGB,
!                GL_UNSIGNED_BYTE, NULL);
!     DBG(_print_glerror(7));
      break;
    };
    };
    switch(txi->tilemode)
      {
--- 579,637 ----
  #ifdef GL_EXT_paletted_texture
      if (pf->palette != NULL) {
+       for (int ck = 0; ck < ncolors; ck++) {
+       SDL_Color* c = pf->palette->colors + ck;
+       refpal[ck][0] = c->r;
+       refpal[ck][1] = c->g;
+       refpal[ck][2] = c->b;
+       refpal[ck][3] = c->unused;
+       };
+       // PG_LogMSG("Pal size %ix%i",txi->texsize, txi->texsize);
        glColorTableEXT(GL_TEXTURE_2D,GL_RGBA,    256,
!                     GL_RGBA,GL_UNSIGNED_BYTE, refpal);
!       DBG(_print_glerror(301));
!       tinternalFormat = GL_COLOR_INDEX8_EXT;
!       tformat = GL_COLOR_INDEX;
        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
        break;
      };
  #endif
  #endif
! #endif /* USE_PALETTE_TEXTURES */
!     PG_LogMSG("Grey size %ix%i",txi->texsize, txi->texsize);
!     tinternalFormat = GL_LUMINANCE8;
!     tformat = GL_LUMINANCE;
      DBG(_print_glerror(5));
      break;
    };
    case _GreyAlpha: {
!     PG_LogMSG("Grey Alpha size %ix%i",txi->texsize, txi->texsize);
!     tinternalFormat = GL_LUMINANCE8_ALPHA8;
!     tformat = GL_LUMINANCE_ALPHA;
      DBG(_print_glerror(6));
      break;
    };
    case _RGBx: {
!     // PG_LogMSG("RGB size %ix%i",txi->texsize, txi->texsize);
! #if 0
!     PG_LogMSG("amask %s size %ix%i form %s",
!             pf->Amask ? "GL_RGBA8" : "GL_RGB8",
!             txi->texsize, txi->texsize,
!             pf->Amask ? "GL_RGBA" : "GL_RGB");
! #endif
!     tinternalFormat = pf->Amask ? GL_RGBA8 : GL_RGB8;
!     tformat = pf->Amask ? GL_RGBA : GL_RGB;
! #ifdef GL_VERSION_1_2
!     /* if Rmask wrong, assume in BGR format - only valid in OpenGL 1.2+ */
!     if (pf->Rmask != _RGBfmt.Rmask) {
!       tformat = pf->Amask ? GL_BGRA : GL_BGR;
!     };
! #endif
      break;
    };
    };
+   glTexImage2D(GL_TEXTURE_2D, 0, tinternalFormat, txi->texsize, txi->texsize,
+              0, tformat, ttype, NULL);
+   DBG(_print_glerror(2));
+ 
    switch(txi->tilemode)
      {
***************
*** 584,587 ****
--- 660,664 ----
          };
          case _Pal: {
+ #ifdef USE_PALETTE_TEXTURES
  #ifdef GL_VERSION_1_2
            if (pf->palette != NULL) {
***************
*** 603,606 ****
--- 680,684 ----
  #endif
  #endif
+ #endif /* USE_PALETTE_TEXTURES */
            glTexSubImage2D(GL_TEXTURE_2D, 0,0, toy,thistw, txi->tileh,
                            GL_LUMINANCE, GL_UNSIGNED_BYTE,
***************
*** 658,661 ****
--- 736,740 ----
          };
          case _Pal: {
+ #ifdef USE_PALETTE_TEXTURES
  #ifdef GL_VERSION_1_2
            if (pf->palette != NULL) {
***************
*** 677,680 ****
--- 756,760 ----
  #endif
  #endif
+ #endif /* USE_PALETTE_TEXTURES */
            glTexSubImage2D(GL_TEXTURE_2D, 0, tox, 0, txi->tilew, thisth,
                            GL_LUMINANCE, GL_UNSIGNED_BYTE,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]