View Single Post
  #7  
Old 12-10-2004, 06:29 AM
Windcatcher
Demi-God
 
Join Date: Jan 2002
Posts: 1,175
Default

I can't speak for the new files, but when dealing with WLD (or what you plan on turning into WLD) in OpenGL you have to set it to use emissive lighting. This wouldn't be so bad except for the problem that, when dealing with alpha transparency, OpenGL likes to throw out the alpha value when you use the glColor4ub() command to set the color. My solution is to cache the last-set alpha value and switch to normal lighting mode with glColorMaterial(GL_FRONT,GL_AMBIENT_AND_DIFFUSE) to change it whenever I encounter a triangle with a different alpha value, then change back with glColorMaterial(GL_FRONT,GL_EMISSION). Generally the only three alpha values you ever run across are 0, 128, and 255, so it's not too bad, especially if you do a two-pass rendering process like I do where you first render only the triangles with alpha=255 and then render anything not 255 in the second pass. I have to warn you though that glColorMaterial is very expensive to use in terms of time (according to the docs on msdn) and must be used as sparingly as possible.
Reply With Quote