Sohta
2003.12.01, 01:22 PM
Okay, I have a display list that I wish to display as a opaque object or as a transparent object depending on the situation.
Now if the polygons in the display list are texture mapped, it's easy, I'd just set the material's alpha value to either 1.0 or 0.5 depending on the situation.
The tricky problem here is that my display lists contain calls to glColor4v() (I'm currently using GL_COLOR_MATERIAL). So the alpha channel gets changed during the execution of the display list.
Also, when I draw the object in the "Opaque mode", I may have translucent parts. So I need to use glColor4f (and not glColor3f ). The idea is to create a "ghost mode".
My question to you is : what's the most effecient way to do blending without using the alpha channel?
current options:
- 1
draw the display list in an offscreen buffer,
call glPixelTransferf(GL_POST_COLOR_MATRIX_ALPHA_SCALE, 0.5);
And then copy (and blend) the pixels to the current color buffer.
(wich is probably a bad idea, since it could get heavy if the object is seen from a short distance. i.e. lots of pixels to multiply by the color matrix, transfer and blend)
- 2
Use plain colored textures with an alpha channel for non-textured polygons. (feels a bit wasty)
- 3
Give up transparency in the base objects and use the alpha channel only for the ghost-mode. (a bit of a shame)
any suggestions?
thanks
Now if the polygons in the display list are texture mapped, it's easy, I'd just set the material's alpha value to either 1.0 or 0.5 depending on the situation.
The tricky problem here is that my display lists contain calls to glColor4v() (I'm currently using GL_COLOR_MATERIAL). So the alpha channel gets changed during the execution of the display list.
Also, when I draw the object in the "Opaque mode", I may have translucent parts. So I need to use glColor4f (and not glColor3f ). The idea is to create a "ghost mode".
My question to you is : what's the most effecient way to do blending without using the alpha channel?
current options:
- 1
draw the display list in an offscreen buffer,
call glPixelTransferf(GL_POST_COLOR_MATRIX_ALPHA_SCALE, 0.5);
And then copy (and blend) the pixels to the current color buffer.
(wich is probably a bad idea, since it could get heavy if the object is seen from a short distance. i.e. lots of pixels to multiply by the color matrix, transfer and blend)
- 2
Use plain colored textures with an alpha channel for non-textured polygons. (feels a bit wasty)
- 3
Give up transparency in the base objects and use the alpha channel only for the ghost-mode. (a bit of a shame)
any suggestions?
thanks