handle images that have alpha vhannel but are arbage (in gl) eg 0 or
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 20 Jan 2010 03:59:32 +0000 (03:59 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 20 Jan 2010 03:59:32 +0000 (03:59 +0000)
something other than 0xff

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@45350 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/gl_common/evas_gl_common.h
src/modules/engines/gl_common/evas_gl_context.c
src/modules/engines/gl_common/evas_gl_texture.c
src/modules/engines/gl_common/shader/compile-s3c6410.sh
src/modules/engines/gl_common/shader/compile-sgx.sh
src/modules/engines/gl_common/shader/img_frag.h
src/modules/engines/gl_common/shader/img_frag.shd
src/modules/engines/gl_common/shader/img_vert.h
src/modules/engines/gl_common/shader/img_vert.shd

index da4111c..f9e4ce9 100644 (file)
@@ -135,6 +135,11 @@ struct _Evas_GL_Context
       GLfloat *texuv2;
       GLfloat *texuv3;
       Eina_Bool line : 1;
+      Eina_Bool use_vertex : 1;
+      Eina_Bool use_color : 1;
+      Eina_Bool use_texuv : 1;
+      Eina_Bool use_texuv2 : 1;
+      Eina_Bool use_texuv3 : 1;
    } array;
    struct {
       Eina_Bool size : 1;
index bb21b8e..9b6ceed 100644 (file)
@@ -228,7 +228,6 @@ evas_gl_common_context_new(void)
         
         glEnableVertexAttribArray(SHAD_VERTEX);
         glEnableVertexAttribArray(SHAD_COLOR);
-        glEnableVertexAttribArray(SHAD_TEXUV);
         
         evas_gl_common_shader_program_init(&(shared->shader.rect), 
                                            &(shader_rect_vert_src), 
@@ -307,9 +306,9 @@ evas_gl_common_context_free(Evas_GL_Context *gc)
      }
    
 
-   free(gc->array.vertex);
-   free(gc->array.color);
-   free(gc->array.texuv);
+   if (gc->array.vertex) free(gc->array.vertex);
+   if (gc->array.color) free(gc->array.color);
+   if (gc->array.texuv) free(gc->array.texuv);
    if (gc->array.texuv2) free(gc->array.texuv2);
    if (gc->array.texuv3) free(gc->array.texuv3);
    
@@ -385,16 +384,21 @@ _evas_gl_common_context_array_alloc(Evas_GL_Context *gc)
 {
    if (gc->array.num <= gc->array.alloc) return;
    gc->array.alloc += 6 * 1024;
-   gc->array.vertex = realloc(gc->array.vertex,
-                              gc->array.alloc * sizeof(GLshort) * 3);
-   gc->array.color  = realloc(gc->array.color,
-                              gc->array.alloc * sizeof(GLubyte) * 4);
-   gc->array.texuv  = realloc(gc->array.texuv,
-                              gc->array.alloc * sizeof(GLfloat) * 2);
-   gc->array.texuv2  = realloc(gc->array.texuv2,
-                               gc->array.alloc * sizeof(GLfloat) * 2);
-   gc->array.texuv3  = realloc(gc->array.texuv3,
+   if (gc->array.use_vertex)
+     gc->array.vertex = realloc(gc->array.vertex,
+                                gc->array.alloc * sizeof(GLshort) * 3);
+   if (gc->array.use_color)
+     gc->array.color  = realloc(gc->array.color,
+                                gc->array.alloc * sizeof(GLubyte) * 4);
+   if (gc->array.use_texuv)
+     gc->array.texuv  = realloc(gc->array.texuv,
+                                gc->array.alloc * sizeof(GLfloat) * 2);
+   if (gc->array.use_texuv2)
+     gc->array.texuv2  = realloc(gc->array.texuv2,
                                gc->array.alloc * sizeof(GLfloat) * 2);
+   if (gc->array.use_texuv3)
+     gc->array.texuv3  = realloc(gc->array.texuv3,
+                                 gc->array.alloc * sizeof(GLfloat) * 2);
 }
 
 void
@@ -412,7 +416,7 @@ evas_gl_common_context_line_push(Evas_GL_Context *gc,
    if (gc->dc->render_op == EVAS_RENDER_COPY) blend = 0;
    gc->shader.cur_tex = 0;
    gc->shader.cur_prog = gc->shared->shader.rect.prog;
-   gc->shader.blend = blend;
+   gc->shader.blend = 1;
    gc->shader.render_op = gc->dc->render_op;
    gc->shader.clip = clip;
    gc->shader.cx = cx;
@@ -421,13 +425,19 @@ evas_gl_common_context_line_push(Evas_GL_Context *gc,
    gc->shader.ch = ch;
    
    gc->array.line = 1;
+   gc->array.use_vertex = 1;
+   gc->array.use_color = 1;
+   gc->array.use_texuv = 0;
+   gc->array.use_texuv2 = 0;
+   gc->array.use_texuv3 = 0;
+   
    pnum = gc->array.num;
    nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4;
    gc->array.num += 1;
    _evas_gl_common_context_array_alloc(gc);
   
-   PUSH_VERTEX(x1    , y1    , 0);
-   PUSH_VERTEX(x2    , y2    , 0);
+   PUSH_VERTEX(x1, y1, 0);
+   PUSH_VERTEX(x2, y2, 0);
    
    for (i = 0; i < 2; i++)
      {
@@ -436,6 +446,11 @@ evas_gl_common_context_line_push(Evas_GL_Context *gc,
    
    shader_array_flush(gc);
    gc->array.line = 0;
+   gc->array.use_vertex = 0;
+   gc->array.use_color = 0;
+   gc->array.use_texuv = 0;
+   gc->array.use_texuv2 = 0;
+   gc->array.use_texuv3 = 0;
 }
 
 void
@@ -448,9 +463,12 @@ evas_gl_common_context_rectangle_push(Evas_GL_Context *gc,
    
    if (a < 255) blend = 1;
    if (gc->dc->render_op == EVAS_RENDER_COPY) blend = 0;
+   
+   gc->shader.blend = 1;
+   
    if ((gc->shader.cur_tex != 0)
        || (gc->shader.cur_prog != gc->shared->shader.rect.prog)
-       || (gc->shader.blend != blend)
+//       || (gc->shader.blend != blend)
        || (gc->shader.render_op != gc->dc->render_op)
        || (gc->shader.clip != 0)
        )
@@ -458,10 +476,17 @@ evas_gl_common_context_rectangle_push(Evas_GL_Context *gc,
         shader_array_flush(gc);
         gc->shader.cur_tex = 0;
         gc->shader.cur_prog = gc->shared->shader.rect.prog;
-        gc->shader.blend = blend;
+        gc->shader.blend = 1;
         gc->shader.render_op = gc->dc->render_op;
         gc->shader.clip = 0;
+
      }
+   gc->array.line = 0;
+   gc->array.use_vertex = 1;
+   gc->array.use_color = 1;
+   gc->array.use_texuv = 0;
+   gc->array.use_texuv2 = 0;
+   gc->array.use_texuv3 = 0;
    
    pnum = gc->array.num;
    nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4;
@@ -478,10 +503,6 @@ evas_gl_common_context_rectangle_push(Evas_GL_Context *gc,
    
    for (i = 0; i < 6; i++)
      {
-        PUSH_TEXUV(0.0, 0.0);
-     }
-   for (i = 0; i < 6; i++)
-     {
         PUSH_COLOR(r, g, b, a);
      }
 }
@@ -494,17 +515,20 @@ evas_gl_common_context_image_push(Evas_GL_Context *gc,
                                   int r, int g, int b, int a,
                                   Eina_Bool smooth)
 {
-   int pnum, nv, nc, nu, nt, i;
+   int pnum, nv, nc, nu, nu2, nt, i;
    GLfloat tx1, tx2, ty1, ty2;
+   GLfloat bl = 1.0;
    Eina_Bool blend = 1;
 
    if (tex->pt->format == GL_RGB) blend = 0;
-   if (a < 255) blend = 1;
+//   if (a < 255) blend = 1;
+   
+   gc->shader.blend = 1;
    
    if ((gc->shader.cur_tex != tex->pt->texture)
        || (gc->shader.cur_prog != gc->shared->shader.img.prog)
        || (gc->shader.smooth != smooth)
-       || (gc->shader.blend != blend)
+//       || (gc->shader.blend != blend)
        || (gc->shader.render_op != gc->dc->render_op)
        || (gc->shader.clip != 0)
        )
@@ -513,13 +537,20 @@ evas_gl_common_context_image_push(Evas_GL_Context *gc,
         gc->shader.cur_tex = tex->pt->texture;
         gc->shader.cur_prog = gc->shared->shader.img.prog;
         gc->shader.smooth = smooth;
-        gc->shader.blend = blend;
+        gc->shader.blend = 1;
         gc->shader.render_op = gc->dc->render_op;
         gc->shader.clip = 0;
-     }
-   
+     } 
+   gc->array.line = 0;
+   gc->array.use_vertex = 1;
+   gc->array.use_color = 1;
+   gc->array.use_texuv = 1;
+   gc->array.use_texuv2 = 1;
+   gc->array.use_texuv3 = 0;
+  
    pnum = gc->array.num;
-   nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4;
+   nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2;
+   nt = pnum * 4;
    gc->array.num += 6;
    _evas_gl_common_context_array_alloc(gc);
 
@@ -528,6 +559,8 @@ evas_gl_common_context_image_push(Evas_GL_Context *gc,
    tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w;
    ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h;
    
+   if (blend) bl = 0.0;
+   
    PUSH_VERTEX(x    , y    , 0);
    PUSH_VERTEX(x + w, y    , 0);
    PUSH_VERTEX(x    , y + h, 0);
@@ -536,6 +569,10 @@ evas_gl_common_context_image_push(Evas_GL_Context *gc,
    PUSH_TEXUV(tx2, ty1);
    PUSH_TEXUV(tx1, ty2);
    
+   PUSH_TEXUV2(bl, 0.0);
+   PUSH_TEXUV2(bl, 0.0);
+   PUSH_TEXUV2(bl, 0.0);
+   
    PUSH_VERTEX(x + w, y    , 0);
    PUSH_VERTEX(x + w, y + h, 0);
    PUSH_VERTEX(x    , y + h, 0);
@@ -544,6 +581,10 @@ evas_gl_common_context_image_push(Evas_GL_Context *gc,
    PUSH_TEXUV(tx2, ty2);
    PUSH_TEXUV(tx1, ty2);
 
+   PUSH_TEXUV2(bl, 0.0);
+   PUSH_TEXUV2(bl, 0.0);
+   PUSH_TEXUV2(bl, 0.0);
+   
    for (i = 0; i < 6; i++)
      {
         PUSH_COLOR(r, g, b, a);
@@ -560,10 +601,12 @@ evas_gl_common_context_font_push(Evas_GL_Context *gc,
    int pnum, nv, nc, nu, nt, i;
    GLfloat tx1, tx2, ty1, ty2;
 
+   gc->shader.blend = 1;
+   
    if ((gc->shader.cur_tex != tex->pt->texture)
        || (gc->shader.cur_prog != gc->shared->shader.font.prog)
        || (gc->shader.smooth != 0)
-       || (gc->shader.blend != 1)
+//       || (gc->shader.blend != 1)
        || (gc->shader.render_op != gc->dc->render_op)
        || (gc->shader.clip != 0)
        )
@@ -576,6 +619,12 @@ evas_gl_common_context_font_push(Evas_GL_Context *gc,
         gc->shader.render_op = gc->dc->render_op;
         gc->shader.clip = 0;
      }
+   gc->array.line = 0;
+   gc->array.use_vertex = 1;
+   gc->array.use_color = 1;
+   gc->array.use_texuv = 1;
+   gc->array.use_texuv2 = 0;
+   gc->array.use_texuv3 = 0;
    
    pnum = gc->array.num;
    nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4;
@@ -633,10 +682,12 @@ evas_gl_common_context_yuv_push(Evas_GL_Context *gc,
 
    if (a < 255) blend = 1;
    
+   gc->shader.blend = 1;
+   
    if ((gc->shader.cur_tex != tex->pt->texture)
        || (gc->shader.cur_prog != gc->shared->shader.yuv.prog)
        || (gc->shader.smooth != smooth)
-       || (gc->shader.blend != blend)
+//       || (gc->shader.blend != blend)
        || (gc->shader.render_op != gc->dc->render_op)
        || (gc->shader.clip != 0)
        )
@@ -647,10 +698,16 @@ evas_gl_common_context_yuv_push(Evas_GL_Context *gc,
         gc->shader.cur_texv = tex->ptv->texture;
         gc->shader.cur_prog = gc->shared->shader.yuv.prog;
         gc->shader.smooth = smooth;
-        gc->shader.blend = blend;
+        gc->shader.blend = 1;
         gc->shader.render_op = gc->dc->render_op;
         gc->shader.clip = 0;
      }
+   gc->array.line = 0;
+   gc->array.use_vertex = 1;
+   gc->array.use_color = 1;
+   gc->array.use_texuv = 1;
+   gc->array.use_texuv2 = 1;
+   gc->array.use_texuv3 = 1;
    
    pnum = gc->array.num;
    nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; 
@@ -714,23 +771,24 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc,
                                        int r, int g, int b, int a,
                                        Eina_Bool smooth, Eina_Bool tex_only)
 {
-   int pnum, nv, nc, nu, nt, i;
+   int pnum, nv, nc, nu, nu2, nt, i;
    const int points[6] = { 0, 1, 2, 0, 2, 3 };
    GLfloat tx[4], ty[4];
+   GLfloat bl = 1.0;
    Eina_Bool blend = 1;
    RGBA_Map_Point *pt;
    DATA32 cmul;
 
-   blend = 1;
+   gc->shader.blend = 1;
    
-//   if (tex->pt->format == GL_RGB) blend = 0;
+   if (tex->pt->format == GL_RGB) blend = 0;
 //   if (a < 255) blend = 1;
    
    if ((gc->shader.cur_tex != tex->pt->texture)
        || ((tex_only) && (gc->shader.cur_prog != gc->shared->shader.tex.prog))
        || ((!tex_only) && (gc->shader.cur_prog != gc->shared->shader.img.prog))
        || (gc->shader.smooth != smooth)
-       || (gc->shader.blend != blend)
+//       || (gc->shader.blend != blend)
        || (gc->shader.render_op != gc->dc->render_op)
        || (gc->shader.clip != clip)
        || (gc->shader.cx != cx)
@@ -746,7 +804,7 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc,
         else
           gc->shader.cur_prog =gc->shared->shader.img.prog; 
         gc->shader.smooth = smooth;
-        gc->shader.blend = blend;
+        gc->shader.blend = 1;
         gc->shader.render_op = gc->dc->render_op;
         gc->shader.clip = clip;
         gc->shader.cx = cx;
@@ -754,9 +812,16 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc,
         gc->shader.cw = cw;
         gc->shader.ch = ch;
      }
+   gc->array.line = 0;
+   gc->array.use_vertex = 1;
+   gc->array.use_color = 1;
+   gc->array.use_texuv = 1;
+   gc->array.use_texuv2 = 1;
+   gc->array.use_texuv3 = 0;
    
    pnum = gc->array.num;
-   nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4;
+   nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2;
+   nt = pnum * 4;
    gc->array.num += 6;
    _evas_gl_common_context_array_alloc(gc);
 
@@ -767,6 +832,9 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc,
         ty[i] = ((double)(tex->y) + (((double)p[i].v) / FP1)) / 
           (double)tex->pt->h;
      }
+   
+   if (blend) bl = 0.0;
+   
    cmul = ARGB_JOIN(a, r, g, b);
    for (i = 0; i < 6; i++)
      {
@@ -778,6 +846,9 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc,
 //                    (p[points[i]].z >> FP));
         PUSH_TEXUV(tx[points[i]],
                    ty[points[i]]);
+        
+        PUSH_TEXUV2(bl, 0.0);
+   
         PUSH_COLOR(R_VAL(&cl),
                    G_VAL(&cl),
                    B_VAL(&cl),
@@ -895,17 +966,24 @@ shader_array_flush(Evas_GL_Context *gc)
  */
    glVertexAttribPointer(SHAD_VERTEX, 3, GL_SHORT, GL_FALSE, 0, gc->array.vertex);
    glVertexAttribPointer(SHAD_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, gc->array.color);
-   glVertexAttribPointer(SHAD_TEXUV, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv);
+   if (gc->array.use_texuv)
+     {
+        glEnableVertexAttribArray(SHAD_TEXUV);
+        glVertexAttribPointer(SHAD_TEXUV, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv);
+     }
+   else
+     glDisableVertexAttribArray(SHAD_TEXUV);
    
    if (gc->array.line)
      {
-        glDisableVertexAttribArray(SHAD_TEXUV2);
+        glDisableVertexAttribArray(SHAD_TEXUV);
+        glDisableVertexAttribArray(SHAD_TEXUV2); 
         glDisableVertexAttribArray(SHAD_TEXUV3);
         glDrawArrays(GL_LINES, 0, gc->array.num);
      }
    else
      {
-        if ((gc->array.texuv2) && (gc->array.texuv3))
+        if ((gc->array.use_texuv2) && (gc->array.use_texuv3))
           {
              glEnableVertexAttribArray(SHAD_TEXUV2);
              glEnableVertexAttribArray(SHAD_TEXUV3);
@@ -916,6 +994,11 @@ shader_array_flush(Evas_GL_Context *gc)
              glActiveTexture(GL_TEXTURE2);
              glBindTexture(GL_TEXTURE_2D, gc->shader.cur_texv);
           }
+        else if (gc->array.use_texuv2)
+          {
+             glEnableVertexAttribArray(SHAD_TEXUV2);
+             glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv2);
+          }
         else
           {
              glDisableVertexAttribArray(SHAD_TEXUV2);
@@ -935,9 +1018,9 @@ shader_array_flush(Evas_GL_Context *gc)
    gc->shader.current.cw = gc->shader.cw;
    gc->shader.current.ch = gc->shader.ch;
    
-   free(gc->array.vertex);
-   free(gc->array.color);
-   free(gc->array.texuv);
+   if (gc->array.vertex) free(gc->array.vertex);
+   if (gc->array.color) free(gc->array.color);
+   if (gc->array.texuv) free(gc->array.texuv);
    if (gc->array.texuv2) free(gc->array.texuv2);
    if (gc->array.texuv3) free(gc->array.texuv3);
    
index fa31ed4..d2f83c2 100644 (file)
@@ -3,8 +3,8 @@
 #if 1
 static const GLenum rgba_fmt   = GL_RGBA;
 static const GLenum rgba_ifmt  = GL_RGBA;
-static const GLenum rgb_fmt    = GL_RGBA;
-static const GLenum rgb_ifmt   = GL_RGBA;
+static const GLenum rgb_fmt    = GL_RGB;
+static const GLenum rgb_ifmt   = GL_RGB;
 static const GLenum alpha_fmt  = GL_ALPHA;
 static const GLenum alpha_ifmt = GL_ALPHA;
 static const GLenum lum_fmt    = GL_LUMINANCE;
@@ -12,8 +12,8 @@ static const GLenum lum_ifmt   = GL_LUMINANCE;
 #else
 static const GLenum rgba_fmt   = GL_RGBA;
 static const GLenum rgba_ifmt  = GL_COMPRESSED_RGBA;
-static const GLenum rgb_fmt    = GL_RGBA;
-static const GLenum rgb_ifmt   = GL_COMPRESSED_RGBA;
+static const GLenum rgb_fmt    = GL_RGB;
+static const GLenum rgb_ifmt   = GL_COMPRESSED_RGB;
 static const GLenum alpha_fmt  = GL_ALPHA;
 static const GLenum alpha_ifmt = GL_COMPRESSED_ALPHA;
 static const GLenum lum_fmt    = GL_LUMINANCE;
@@ -386,42 +386,48 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
    // 
    _tex_sub_2d(tex->x, tex->y, 
                im->cache_entry.w, im->cache_entry.h,
-               tex->pt->format, tex->pt->dataformat,
+//               tex->pt->format, tex->pt->dataformat,
+               rgba_fmt, tex->pt->dataformat,
                im->image.data);
    // |xxx
    // |xxx
    // 
    _tex_sub_2d(tex->x - 1, tex->y, 
                1, im->cache_entry.h,
-               tex->pt->format, tex->pt->dataformat,
+//               tex->pt->format, tex->pt->dataformat,
+               rgba_fmt, tex->pt->dataformat,
                im->image.data);
    //  xxx|
    //  xxx|
    // 
    _tex_sub_2d(tex->x + im->cache_entry.w, tex->y, 
                1, im->cache_entry.h,
-               tex->pt->format, tex->pt->dataformat,
+//               tex->pt->format, tex->pt->dataformat,
+               rgba_fmt, tex->pt->dataformat,
                im->image.data + (im->cache_entry.w - 1));
    //  xxx
    //  xxx
    //  ---
    _tex_sub_2d(tex->x, tex->y + im->cache_entry.h,
                im->cache_entry.w, 1,
-               tex->pt->format, tex->pt->dataformat,
+//               tex->pt->format, tex->pt->dataformat,
+               rgba_fmt, tex->pt->dataformat,
                im->image.data + ((im->cache_entry.h - 1) * im->cache_entry.w));
    //  xxx
    //  xxx
    // o
    _tex_sub_2d(tex->x - 1, tex->y + im->cache_entry.h,
                1, 1,
-               tex->pt->format, tex->pt->dataformat,
+//               tex->pt->format, tex->pt->dataformat,
+               rgba_fmt, tex->pt->dataformat,
                im->image.data + ((im->cache_entry.h - 1) * im->cache_entry.w));
    //  xxx
    //  xxx
    //     o
    _tex_sub_2d(tex->x + im->cache_entry.w, tex->y + im->cache_entry.h,
                1, 1,
-               tex->pt->format, tex->pt->dataformat,
+//               tex->pt->format, tex->pt->dataformat,
+               rgba_fmt, tex->pt->dataformat,
                im->image.data + ((im->cache_entry.h - 1) * im->cache_entry.w) + (im->cache_entry.w - 1));
    if (tex->pt->texture != tex->gc->shader.cur_tex)
      glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex);
index 0de88d4..d7790c0 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-ORIONEXE=/home/raster/Data/orion/orion.exe
+ORIONEXE=/home/raster/samsung/build/x1/tools/orion/orion.exe
 OPTS="-O --nolodcalc -lp"
 
 function compile()
index e665c30..5eeb226 100644 (file)
@@ -4,7 +4,10 @@
 "uniform sampler2D tex;\n"
 "varying vec4 col;\n"
 "varying vec2 tex_c;\n"
+"varying vec2 tex_c2;\n"
 "void main()\n"
 "{\n"
-"   gl_FragColor = texture2D(tex, tex_c.xy).bgra * col;\n"
+"   vec4 t = texture2D(tex, tex_c.xy).bgra;\n"
+"   vec4 c = vec4(t.r, t.g, t.b, t.a + tex_c2.x);\n"
+"   gl_FragColor = c * col;\n"
 "}\n"
index ce3b517..8e31ec9 100644 (file)
@@ -4,7 +4,10 @@ precision mediump float;
 uniform sampler2D tex;
 varying vec4 col;
 varying vec2 tex_c;
+varying vec2 tex_c2;
 void main()
 {
-   gl_FragColor = texture2D(tex, tex_c.xy).bgra * col;
+   vec4 t = texture2D(tex, tex_c.xy).bgra;
+   vec4 c = vec4(t.r, t.g, t.b, t.a + tex_c2.x);
+   gl_FragColor = c * col;
 }
index ef035c8..ae3ae71 100644 (file)
@@ -4,12 +4,15 @@
 "attribute vec4 vertex;\n"
 "attribute vec4 color;\n"
 "attribute vec2 tex_coord;\n"
+"attribute vec2 tex_coord2;\n"
 "uniform mat4 mvp;\n"
 "varying vec4 col;\n"
 "varying vec2 tex_c;\n"
+"varying vec2 tex_c2;\n"
 "void main()\n"
 "{\n"
 "   gl_Position = mvp * vertex;\n"
 "   col = color;\n"
 "   tex_c = tex_coord;\n"
+"   tex_c2 = tex_coord2;\n"
 "}\n"
index cf98501..3e8931b 100644 (file)
@@ -4,12 +4,15 @@ precision mediump float;
 attribute vec4 vertex;
 attribute vec4 color;
 attribute vec2 tex_coord;
+attribute vec2 tex_coord2;
 uniform mat4 mvp;
 varying vec4 col;
 varying vec2 tex_c;
+varying vec2 tex_c2;
 void main()
 {
    gl_Position = mvp * vertex;
    col = color;
    tex_c = tex_coord;
+   tex_c2 = tex_coord2;
 }