Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/modules/engines/gl_common Modified Files: evas_gl_common.h evas_gl_context.c evas_gl_texture.c Log Message: fragment shader finally actually works. it's unclean and fixme's for seeding the pixel data - but it works! =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_common.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- evas_gl_common.h 17 Dec 2006 15:48:51 -0000 1.7 +++ evas_gl_common.h 18 Dec 2006 14:55:47 -0000 1.8 @@ -76,6 +76,7 @@ Evas_GL_Texture *texture; GLuint font_texture; unsigned char font_texture_rectangle : 1; + unsigned char texture_program : 1; int max_texture_depth; int max_texture_size; =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_context.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- evas_gl_context.c 17 Dec 2006 15:48:51 -0000 1.4 +++ evas_gl_context.c 18 Dec 2006 14:55:47 -0000 1.5 @@ -318,6 +318,16 @@ if (gc->font_texture > 0) { glUseProgramObjectARB(0); + if (gc->texture_program) + { + glUseProgramObjectARB(0); + + glActiveTexture(GL_TEXTURE1); + glDisable(GL_TEXTURE_2D); + glActiveTexture(GL_TEXTURE2); + glDisable(GL_TEXTURE_2D); + gc->texture_program = 0; + } if (gc->font_texture_rectangle) { glEnable(GL_TEXTURE_2D); @@ -346,8 +356,11 @@ if ((gc->texture->prog) && (gc->texture->texture2) && (gc->texture->texture3)) { - int i; - + gc->texture_program = 1; + glActiveTexture(GL_TEXTURE0); + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, gc->texture->texture); + glActiveTexture(GL_TEXTURE1); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, gc->texture->texture2); @@ -355,22 +368,20 @@ glActiveTexture(GL_TEXTURE2); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, gc->texture->texture3); - - glActiveTexture(GL_TEXTURE0); - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, gc->texture->texture); - glUseProgramObjectARB(gc->texture->prog); } else { - glUseProgramObjectARB(0); - - glActiveTexture(GL_TEXTURE1); - glDisable(GL_TEXTURE_2D); - glActiveTexture(GL_TEXTURE2); - glDisable(GL_TEXTURE_2D); - + if (gc->texture_program) + { + glUseProgramObjectARB(0); + + glActiveTexture(GL_TEXTURE1); + glDisable(GL_TEXTURE_2D); + glActiveTexture(GL_TEXTURE2); + glDisable(GL_TEXTURE_2D); + gc->texture_program = 0; + } glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, gc->texture->texture); glEnable(GL_TEXTURE_2D); =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_texture.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- evas_gl_texture.c 17 Dec 2006 15:48:51 -0000 1.2 +++ evas_gl_texture.c 18 Dec 2006 14:55:47 -0000 1.3 @@ -442,18 +442,15 @@ { const char *code = - "uniform sampler2D Ytex, Utex, Vtex;\n" + "uniform sampler2D ytex, utex, vtex;\n" "void main(void) {\n" " float r, g, b, y, u, v;\n" - " y = texture2D(Ytex, gl_TexCoord[0].st).r;\n" - " u = texture2D(Utex, gl_TexCoord[0].st).r;\n" - " v = texture2D(Vtex, gl_TexCoord[0].st).r;\n" + " y = texture2D(ytex, gl_TexCoord[0].st).r;\n" + " u = texture2D(utex, gl_TexCoord[0].st).r;\n" + " v = texture2D(vtex, gl_TexCoord[0].st).r;\n" -#if 0 // enable this to direct-test y u and v values - " gl_FragColor = vec4(y, u, v, 1.0);\n" -#else " y = (y - 0.0625) * 1.164;\n" " u = u - 0.5;\n" " v = v - 0.5;\n" @@ -463,7 +460,7 @@ " b = y + (1.772 * u);\n" " gl_FragColor = vec4(r, g, b, 1.0);\n" -#endif + "}\n"; glShaderSourceARB(fshad, 1, &code, NULL); } @@ -474,9 +471,13 @@ glEnable(GL_TEXTURE_2D); texfmt = GL_LUMINANCE; + + glUseProgramObjectARB(tex->prog); + glUniform1iARB(glGetUniformLocationARB(tex->prog, "ytex"), 0); + glUniform1iARB(glGetUniformLocationARB(tex->prog, "utex"), 1); + glUniform1iARB(glGetUniformLocationARB(tex->prog, "vtex"), 2); glGenTextures(1, &(tex->texture)); - glUniform1iARB(glGetUniformLocationARB(tex->prog, "Ytex", tex->texture)); glBindTexture(GL_TEXTURE_2D, tex->texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -488,7 +489,6 @@ texfmt, GL_UNSIGNED_BYTE, rows[0]); glGenTextures(1, &(tex->texture2)); - glUniform1iARB(glGetUniformLocationARB(tex->prog, "Utex", tex->texture2)); glBindTexture(GL_TEXTURE_2D, tex->texture2); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -500,7 +500,6 @@ texfmt, GL_UNSIGNED_BYTE, rows[th]); glGenTextures(1, &(tex->texture3)); - glUniform1iARB(glGetUniformLocationARB(tex->prog, "Vtex", 2)); glBindTexture(GL_TEXTURE_2D, tex->texture3); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -510,6 +509,8 @@ glTexImage2D(GL_TEXTURE_2D, 0, texfmt, tw / 2, th / 2, 0, texfmt, GL_UNSIGNED_BYTE, rows[th + (th / 2)]); + + glUseProgramObjectARB(0); if (gc->texture) gc->texture->references--; gc->texture = tex; ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs