Skip to main content
GameDev.net gamedev.net
🔒 Locked

3D objects & progressive opacity texture

Started by Patrice Terrier Sep 10, 2006 at 5:41 AM 2 replies 350+ views
Original Post
Patrice Terrier
Patrice Terrier
I am new here, thus please accept my apologies if I am asking something that has been already answered there. I am doing graphic addons, and I have added support to create OpenGL textures from 32-bit PNG using variable opacity. So far everything works fine except the fact that I doesn't want to use glEnable(GL_DEPTH_TEST) in order to see through the mapped texture. My question is, should I use BSP or is there anything easier to use with OpenGL ? Here is a link to a demo (with PB source code) using texture with variable opacity that shows the problem I would like to solve: Click here to download the demo Screen shot: Patrice Terrier www.zapsolution.com
MARS_999
MARS_999
Look into blending...

glBlendFunc()
zedzeek
zedzeek
u need to glDepthMask( 0 );
+ also either sorting the polygons yourself (which should work on this model)
or use someit like this
http://citeseer.ist.psu.edu/everitt01interactive.html
Patrice Terrier
Patrice Terrier
Here is the code I am using right now.

glEnable(GL_TEXTURE_2D)
glDepthFunc(GL_LESS)
glShadeModel(GL_SMOOTH)
glMatrixMode(GL_PROJECTION)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

'//CALL glEnable(GL_DEPTH_TEST)
'//CALL glDepthMask(0)

glEnable(GL_ALPHA_TEST)

If I have to sort the faces myself, that means using BSP,
I thought there was an OpenGL way that could save me this extra coding.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.