[geeks] OpenGL vs partially transparent textures?

Mouse mouse at Rodents-Montreal.ORG
Fri Jan 22 11:57:36 CST 2016


I'm trying to write some GL code and I'm having trouble.  I'm wondering
if anyone here has the knowledge and inclination to help.

I want to draw a textured polygon with transparency which varies from
texel to texel.  So far I have completely failed; the closest I've
gotten has had all texels taking their transparency from the glColor
setting rather than from the texture.

I've boiled it down to a small test program.
ftp.rodents-montreal.org:/mouse/misc/glx/alphatest.c is the program
(also available over HTTP, though I'm not sure what Content-Type:
bozohttpd will serve it as).  In the same directory, result.gif is the
result I'm seeing.  What I wanted to see was all the white blocks of
the checkerboard texture coming out as opaque white and all black
blocks completely transparent (see setup_texture()).

The manpages make it sound as though I'm doing everything right, but
they are enough of a twisty little maze of pointers that I could easily
be missing something there.  I even tried to do some poking around on
the net, but everything I've found either has no help to offer or
suggests something I'm already doing (typically enabling GL_BLEND and
using glBlendFunc).  I'm wondering whether I'm just doing something
wrong, or I'm stuck with a defective implementation (even though I'm
seeing the same results on NetBSD 5.2 and an Ubuntu laptop I have from
work), or what I want is beyond GL's capabilities, or what.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse at rodents-montreal.org
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


More information about the geeks mailing list