【正文】
L_ONE ? GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ? GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA ? See Redbook for plete list OpenGL Blending and Compositing ? Transparency is implemented using GL_SRC_ALPHA for the source and GL_ONE_MINUS_SRC_ALPHA for the destination ? glEnable(GL_BLEND)。 ? glColor4f(, , , )。 ? glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)。 ? Example ? First draw a red triangle (destination) and then draw a blue triangle (source) on top of it ? With an alpha value of , the blue triangle is 50% transparent Fog ? Fog functions OpenGL Fog Functions GLfloat fcolor[4] = {……}: glEnable(GL_FOG)。 glFogf(GL_FOG_MODE, GL_EXP)。 glFogf(GL_FOG_DENSITY, )。 glFogfv(GL_FOG, fcolor)。 Summary ? You have learned about ? how OpenGL handles colors ? How shading works ? What the elements of lighting model are ? How to control them ? How to use blending ? How to take advantage of OpenGL’s builtin fog References ? Dave Astle and Kevin Hawkins, Beginning OpenGL Game Programming, 1st Edition, Course Technology PTR, 2022. ? ? Edward Angel, Interactive Computer Graphics: A TopDown Approach Using OpenGL, 4th Edition, AddisonWesley Pub. Co., March 2022. ?