16bit Alpha Test?

Started by
3 comments, last by Runt888 19 years, 5 months ago
I want to use an alpha test to block certain parts of a texture. However, the values in the alpha texture are 16 bits (so I have a 24 bit RGB texture and a 16 bit alpha texture). It it possible to use the alpha text with 16 bit values? Kelly
Advertisement
The OpenGL header file (gl.h) defines GL_ALPHA for up to 16-bits.

#define GL_ALPHA4 0x803B
#define GL_ALPHA8 0x803C
#define GL_ALPHA12 0x803D
#define GL_ALPHA16 0x803E

I assume you'd send this as a parameter to glTexImage.

- carb
- Ben
Thanks for the response. Actually, I already have a 16 bit alpha texture. What I need to be able to do is perform the alpha test on 16 bit values.

Here's a better description of the problem:

I have 3D rendered image data in a proprietary format. The data consists of many different structures, each of which can be highlighted and removed from the image. As of now, every time a user clickes on a structure, we peform a look up with the mouse coordinates to get the ID of the structure. With that ID we are able to recreate the image that is being displayed, update the texture, and display it with the structure highlighted. With some optimizations we were able to get this to be fairly fast (less than a second between clicking and the new image being displayed).

However, now we want to have mouse-over highlighting. The above process is too slow to do every time the mouse moves to a different structure. I can use GL to do the blending for me (our highlighting is a 50-50 blend with the pixel color and some other color), but that requires being able to set the alpha value for all the pixels that make up the current structure that the mouse is over. Both the stencil buffer and alpha test could be used for this, except they only use 8 bits (as far as I can tell) and we have IDs ranging from 0 to 11000. We also have the potential to have more than 256 structures visible at the same time, so I can't just map the visible ids to fit in a single byte.

I would like to just do this in a shader, but we want it to work on cards that don't support fragment shaders. If anyone has an idea for this, I would really appreciate it. Thanks!

Kelly
i dont understand 100% what u want but
perhaps u wanna look into floating point buffers,
how ru selecting the struct (opengl selection, drawing each object in a diff color, and reading back, casting a ray in the scene)
Thanks for the reply. Here's a link that will explain what I'm talking about (a picture is worth a thousand words).

Say the user clicks on the pectoralis muscle. That muscle is a structure with a certain ID. Right now, we loop through the data, and when we find a pixel with the correct ID, we blend that pixel with a highlight color.

We want to change it so the user can just mouse-over a structure to have it highlighted. It's easy enough to make an Alpha-16 texture that has the IDs of all the visible structures. I would like to be able to do an alpha test with the ID that the mouse is over, and let GL throw away any fragments where the IDs don't match. However, the values seem to be 8 bit floats.

Do you have a link with information on floating point buffers? Thanks.

Kelly

This topic is closed to new replies.

Advertisement