Jerome Glisse wrote:
According to fragment program extension, TEX, TXP, ... should
give you the right A value (Ap depending on which texture unit
you are using).
That's not how I read that. TEX,TXP,... refer to texture sampling
only, there is no thing as previous unit there. Thus, for an RGB
texture, A should be always 1.
What induced me to this , is that in fragment program extension
description they say to look at table 3.21 and in this one there is
reference to Ap for A in RGB. Anyway i think you are right here.
What version of the spec are you using? Table 3.21 only lists the
component mapping here.
Well, if my theory is sound, then the glean pixelFormats test is wrong.
I've tried to trivially fix it up and also made it possible to use tex
env combine mode. I think this might break the glDrawPixels tests but
oddly enough that didn't happen. I did get a lots of failures though
with an old radeon (and I'm sure r200 will fail too), turns out it
uncovers some driver bugs... radeon and r200 only have an i8
single-component format, and you can't use that for a8 or l8 as the
alpha (or rgb respectively) values will be wrong - guess there was a
reason those formats weren't used initially... (not sure exactly why it
doesn't work for L8, as I'd think if the ALPHA_IN_MAP isn't set this
should work). I'm not quite sure how to fix that, the by far easiest
method is to just use al88, but it would be possible to hack up tex env
instead (and for the r200, fragment shader progs too - ugh). Anyway,
r300 shouldn't have that problem with its native texture sampling
swizzling/component replace.
Roland
Index: tpixelformats.cpp
===================================================================
RCS file: /cvsroot/glean/glean/src/glean/tpixelformats.cpp,v
retrieving revision 1.8
diff -u -r1.8 tpixelformats.cpp
--- tpixelformats.cpp 2 Oct 2006 19:50:53 -0000 1.8
+++ tpixelformats.cpp 15 Oct 2006 13:58:59 -0000
@@ -39,6 +39,7 @@
#define USE_FRAG_PROG 0
+#define USE_TEXENV_COMBINE 1
namespace GLEAN {
@@ -840,7 +841,11 @@
exp[1] = 0;
exp[2] = 0;
exp[testChan] = 255;
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_ALPHA:
exp[0] = 0;
@@ -852,7 +857,11 @@
exp[0] =
exp[1] =
exp[2] = testChan == 0 ? 255 : 0;
- exp[3] = 0; // fragment's alpha
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
+ exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_LUMINANCE_ALPHA:
exp[0] =
@@ -888,7 +897,11 @@
exp[1] = 0;
exp[2] = 0;
exp[testChan] = 255;
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_ALPHA:
exp[0] = 0;
@@ -900,7 +913,11 @@
exp[0] =
exp[1] =
exp[2] = testChan == 0 ? 255 : 0;
- exp[3] = 0; // fragment's alpha
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
+ exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_LUMINANCE_ALPHA:
exp[0] =
@@ -933,7 +950,11 @@
exp[0] = 255;
exp[1] = 0;
exp[2] = 0;
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_ALPHA:
exp[0] = 0;
@@ -945,7 +966,11 @@
exp[0] =
exp[1] =
exp[2] = 255;
- exp[3] = 0; // fragment's alpha
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
+ exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_LUMINANCE_ALPHA:
exp[0] =
@@ -979,7 +1004,11 @@
exp[0] = 0;
exp[1] = 255;
exp[2] = 0;
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_ALPHA:
exp[0] = 0;
@@ -991,7 +1020,11 @@
exp[0] =
exp[1] =
exp[2] = 0;
- exp[3] = 0; // fragment's alpha
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
+ exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_LUMINANCE_ALPHA:
exp[0] =
@@ -1024,7 +1057,11 @@
exp[0] = 0;
exp[1] = 0;
exp[2] = 0;
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_ALPHA:
exp[0] = 0;
@@ -1036,7 +1073,11 @@
exp[0] =
exp[1] =
exp[2] = 0;
- exp[3] = 0; // fragment's alpha
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
+ exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_LUMINANCE_ALPHA:
exp[0] =
@@ -1048,7 +1089,11 @@
exp[0] =
exp[1] =
exp[2] = 0;
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
exp[3] = 0; // fragment's alpha
+#endif
break;
default:
abort();
@@ -1069,7 +1114,11 @@
exp[0] = 255;
exp[1] = 255;
exp[2] = 255;
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_ALPHA:
exp[0] = 0;
@@ -1081,7 +1130,11 @@
exp[0] = 255;
exp[1] = 255;
exp[2] = 255;
- exp[3] = 0; // fragment's alpha
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
+ exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_LUMINANCE_ALPHA:
exp[0] = 255;
@@ -1114,7 +1167,11 @@
exp[0] =
exp[1] =
exp[2] = testChan == 0 ? 255 : 0;
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_ALPHA:
exp[0] =
@@ -1126,7 +1183,11 @@
exp[0] =
exp[1] =
exp[2] = testChan == 0 ? 255 : 0;
- exp[3] = 0; // fragment's alpha
+#if USE_FRAG_PROG || USE_TEXENV_COMBINE
+ exp[3] = 255;
+#else
+ exp[3] = 0; // fragment's alpha
+#endif
break;
case GL_LUMINANCE_ALPHA:
exp[0] = testChan == 0 ? 255 : 0;
@@ -1257,8 +1318,17 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+#if USE_TEXENV_COMBINE
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
+ glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
+ glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
+#else
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
+#endif
glDrawBuffer(GL_FRONT);
glReadBuffer(GL_FRONT);
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel