Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/lib/engines/gl_common
Modified Files:
evas_gl_context.c evas_gl_font.c evas_gl_image.c
evas_gl_texture.c
Log Message:
playing with gl engine :)
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/gl_common/evas_gl_context.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- evas_gl_context.c 6 Oct 2005 02:38:34 -0000 1.12
+++ evas_gl_context.c 8 Oct 2005 06:22:43 -0000 1.13
@@ -66,8 +66,15 @@
if (strstr(ext, "GL_SGIS_generate_mipmap"))
gc->ext.sgis_generate_mipmap = 1;
if (strstr(ext, "GL_NV_texture_rectangle"))
gc->ext.nv_texture_rectangle = 1;
if (strstr(ext, "GL_EXT_texture_rectangle"))
gc->ext.nv_texture_rectangle = 1;
+ if (strstr(ext, "GL_ARB_texture_non_power_of_two"))
gc->ext.arb_texture_non_power_of_two = 1;
printf("GL EXT supported: GL_SGIS_generate_mipmap = %x\n",
gc->ext.sgis_generate_mipmap);
printf("GL EXT supported: GL_NV_texture_rectangle = %x\n",
gc->ext.nv_texture_rectangle);
+ printf("GL EXT supported: GL_ARB_texture_non_power_of_two = %x\n",
gc->ext.arb_texture_non_power_of_two);
+// this causes at least nvidia's drivers to go into pathological pain when
+// changing textures a lot (doing video). so we wont do anything with this
+// for now, but it does work.
+ gc->ext.arb_texture_non_power_of_two = 0; printf("DISABLE
GL_ARB_texture_non_power_of_two\n");
+// gc->ext.nv_texture_rectangle = 0; printf("DISABLE
GL_NV_texture_rectangle\n");
}
else
{
@@ -176,7 +183,7 @@
if (gc->font_texture != ft->texture)
{
gc->font_texture = ft->texture;
- gc->font_texture_not_power_of_two = ft->pool->not_power_of_two;
+ gc->font_texture_rectangle = ft->pool->rectangle;
gc->change.texture = 1;
}
if (!gc->change.texture) return;
@@ -287,7 +294,7 @@
if (!gc->change.texture) return;
if (gc->font_texture > 0)
{
- if (gc->font_texture_not_power_of_two)
+ if (gc->font_texture_rectangle)
{
glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_RECTANGLE_NV);
@@ -303,7 +310,7 @@
}
else if (gc->texture)
{
- if (gc->texture->not_power_of_two)
+ if (gc->texture->rectangle)
{
glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_RECTANGLE_NV);
@@ -315,7 +322,7 @@
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, gc->texture->texture);
}
- if (gc->texture->not_power_of_two)
+ if (gc->texture->rectangle)
{
if (gc->texture->changed)
{
@@ -326,7 +333,7 @@
{
if (gc->texture->changed)
{
- if (gc->texture->not_power_of_two)
+ if (gc->texture->rectangle)
{
if (gc->texture->smooth)
{
@@ -343,6 +350,7 @@
{
if (gc->texture->smooth)
{
+ glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAX_ANISOTROPY_EXT, 8);
glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (gc->texture->have_mipmaps)
glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/gl_common/evas_gl_font.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- evas_gl_font.c 2 Oct 2005 16:06:11 -0000 1.9
+++ evas_gl_font.c 8 Oct 2005 06:22:43 -0000 1.10
@@ -110,7 +110,7 @@
ft->y = ft->alloc->y;
ft->pool = ft->alloc->pool;
ft->texture = ft->pool->texture;
- if (ft->pool->not_power_of_two)
+ if (ft->pool->rectangle)
{
glEnable(GL_TEXTURE_RECTANGLE_NV);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, ft->texture);
@@ -132,9 +132,9 @@
gc->texture = NULL;
}
gc->font_texture = ft->texture;
- gc->font_texture_not_power_of_two = ft->pool->not_power_of_two;
+ gc->font_texture_rectangle = ft->pool->rectangle;
gc->change.texture = 1;
- if (ft->pool->not_power_of_two)
+ if (ft->pool->rectangle)
{
ft->tx1 = ft->x;
ft->ty1 = ft->y;
@@ -263,13 +263,13 @@
fp->gc = gc;
fp->w = minw;
fp->h = minh;
- if (gc->ext.nv_texture_rectangle) fp->not_power_of_two = 1;
+ if (gc->ext.nv_texture_rectangle) fp->rectangle = 1;
/* we dont want this mipmapped if sgis_generate_mipmap will mipmap it */
if (gc->ext.sgis_generate_mipmap)
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
// glEnable(GL_TEXTURE_2D);
- if (fp->not_power_of_two)
+ if (fp->rectangle)
{
glEnable(GL_TEXTURE_RECTANGLE_NV);
glGenTextures(1, &(fp->texture));
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/gl_common/evas_gl_image.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- evas_gl_image.c 6 Oct 2005 02:38:34 -0000 1.7
+++ evas_gl_image.c 8 Oct 2005 06:22:43 -0000 1.8
@@ -176,7 +176,7 @@
(!gc->ext.sgis_generate_mipmap))
evas_gl_common_texture_mipmaps_build(im->tex, im->im, smooth);
- if (im->tex->not_power_of_two)
+ if (im->tex->rectangle)
{
tx1 = sx;
ty1 = sy;
@@ -205,19 +205,9 @@
evas_gl_common_context_write_buf_set(gc, GL_BACK);
glBegin(GL_QUADS);
- if (im->tex->not_power_of_two)
- {
- glTexCoord2d(tx1, ty1); glVertex2i(dx , dy );
- glTexCoord2d(tx2, ty1); glVertex2i(dx + dw, dy );
- glTexCoord2d(tx2, ty2); glVertex2i(dx + dw, dy + dh);
- glTexCoord2d(tx1, ty2); glVertex2i(dx , dy + dh);
- }
- else
- {
- glTexCoord2d(tx1, ty1); glVertex2f(dx , dy );
- glTexCoord2d(tx2, ty1); glVertex2f(dx + dw + 0.5, dy );
- glTexCoord2d(tx2, ty2); glVertex2f(dx + dw + 0.5, dy + dh + 0.5);
- glTexCoord2d(tx1, ty2); glVertex2f(dx , dy + dh + 0.5);
- }
+ glTexCoord2d(tx1, ty1); glVertex2i(dx , dy );
+ glTexCoord2d(tx2, ty1); glVertex2i(dx + dw, dy );
+ glTexCoord2d(tx2, ty2); glVertex2i(dx + dw, dy + dh);
+ glTexCoord2d(tx1, ty2); glVertex2i(dx , dy + dh);
glEnd();
}
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/engines/gl_common/evas_gl_texture.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- evas_gl_texture.c 6 Oct 2005 02:38:34 -0000 1.8
+++ evas_gl_texture.c 8 Oct 2005 06:22:43 -0000 1.9
@@ -13,12 +13,14 @@
tex = calloc(1, sizeof(Evas_GL_Texture));
if (!tex) return NULL;
- if (gc->ext.nv_texture_rectangle)
+ if ((gc->ext.nv_texture_rectangle) &&
+ (!(gc->ext.arb_texture_non_power_of_two &&
+ gc->ext.sgis_generate_mipmap)))
{
tex->gc = gc;
tex->w = im->image->w;
tex->h = im->image->h;
- tex->not_power_of_two = 1;
+ tex->rectangle = 1;
tex->tw = im->image->w;
tex->th = im->image->h;
tex->references = 0;
@@ -55,8 +57,16 @@
return tex;
}
- shift = 1; while (im->image->w > shift) shift = shift << 1; tw = shift;
- shift = 1; while (im->image->h > shift) shift = shift << 1; th = shift;
+ if ((gc->ext.arb_texture_non_power_of_two) &&
(gc->ext.sgis_generate_mipmap))
+ {
+ tw = im->image->w;
+ th = im->image->h;
+ }
+ else
+ {
+ shift = 1; while (im->image->w > shift) shift = shift << 1; tw = shift;
+ shift = 1; while (im->image->h > shift) shift = shift << 1; th = shift;
+ }
tex->gc = gc;
tex->w = tw;
tex->h = th;
@@ -73,7 +83,7 @@
gc->change.texture = 1;
tex->references++;
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 8);
+// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 8);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
@@ -145,7 +155,7 @@
int tw, th;
GLenum pixfmt, texfmt, target;
- if (tex->not_power_of_two)
+ if (tex->rectangle)
{
void *data;
@@ -196,16 +206,16 @@
th = tex->h;
tex->changed = 1;
tex->have_mipmaps = 0;
- if (tex->gc->ext.nv_texture_rectangle) glDisable(GL_TEXTURE_RECTANGLE_NV);
+// if (tex->gc->ext.nv_texture_rectangle) glDisable(GL_TEXTURE_RECTANGLE_NV);
glEnable(GL_TEXTURE_2D);
- if (tex->not_power_of_two)
+ if (tex->rectangle)
{
glEnable(GL_TEXTURE_RECTANGLE_NV);
target = GL_TEXTURE_RECTANGLE_NV;
}
else
{
- glDisable(GL_TEXTURE_RECTANGLE_NV);
+// glDisable(GL_TEXTURE_RECTANGLE_NV);
glEnable(GL_TEXTURE_2D);//
target = GL_TEXTURE_2D;
}
@@ -299,7 +309,7 @@
#endif
if (!smooth) return;
- if (tex->not_power_of_two) return;
+ if (tex->rectangle) return;
#ifdef BUILD_MMX
evas_common_cpu_can_do(&mmx, &sse, &sse2);
#endif
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs