PDA

View Full Version : Texture filtering parameter that cuts out transparent material?



Cubby208
12-19-2015, 11:45 PM
So I had some code going that drew a nice line of dots going in a gradient from most transparent to least transparent. And this all worked great!

Unfortunately I just added something that works like an accumulation buffer using a couple FBO's with textures. And now instead of that gradient going across the screen it goes only about a third of the way.

This indicates that some of the transparent fragments are being discarded or something, and I suspect its a parameter on the texture that is to blame.

Is there something that I should put in the "glTexParameteri()" function that would restore even the most transparent fragments?

Thanks much!

GClements
12-20-2015, 02:36 AM
There is no texture parameter which sets a threshold for alpha.

Did you remember to set the viewport when switching between the window and the FBO? If they aren't the same size, you'll need to explicitly change the viewport each time; the viewport is automatically set to the bounds of the window the first time a context is bound, but doesn't change thereafter unless changed explicitly with glViewport().

If you're accumulating by scaling the colour values prior to adding, you're losing intensity resolution, so values close to zero will be rounded to zero. If that's what's happening, there isn't really any solution other than using a texture with more bits per component (which may be a problem with OpenGL ES 2.0, as it doesn't support sized internal formats; and I don't believe the unsized formats are required to support any particular precision).

mhagain
12-20-2015, 04:43 AM
Have you got alpha test enabled?