def setup_fog(): glEnable(GL_FOG) glFogfv(GL_FOG_COLOR, (GLfloat * 4)(0.5, 0.69, 1.0, 1)) glHint(GL_FOG_HINT, GL_DONT_CARE) glFogi(GL_FOG_MODE, GL_LINEAR) glFogf(GL_FOG_START, 20.0) glFogf(GL_FOG_END, 60.0)
def setup_fog(): # Enables fog. gl.glEnable(gl.GL_FOG) # Sets fog colour. gl.glFogfv(gl.GL_FOG_COLOR, (gl.GLfloat * 4)(0.5, 0.69, 1.0, 1)) gl.glHint(gl.GL_FOG_HINT, gl.GL_DONT_CARE) gl.glFogi(gl.GL_FOG_MODE, gl.GL_LINEAR) # Fog distance. gl.glFogf(gl.GL_FOG_START, 20.0) gl.glFogf(gl.GL_FOG_END, 60.0)
def enable(self): gl.glEnable(gl.GL_FOG) gl.glFogfv(gl.GL_FOG_COLOR, self.color) gl.glFogf(gl.GL_FOG_START, self.start) gl.glFogf(gl.GL_FOG_END, self.end) if self.density is not None: gl.glFogf(gl.GL_FOG_DENSITY, self.density) if self.hint is not None: gl.glHint(gl.GL_FOG_HINT, self.hint) gl.glFogi(gl.GL_FOG_MODE, self.equation)
def init_gl_fog(self): """Configure the OpenGL fog properties.""" # Enable fog. Fog "blends a fog color with each rasterized pixel fragment's # post-texturing color." glEnable(GL_FOG) # Set the fog color. glFogfv(GL_FOG_COLOR, (GLfloat * 4)(0.5, 0.69, 1.0, 1)) # Say we have no preference between rendering speed and quality. glHint(GL_FOG_HINT, GL_DONT_CARE) # Specify the equation used to compute the blending factor. glFogi(GL_FOG_MODE, GL_LINEAR) # How close and far away fog starts and ends. The closer the start and end, # the denser the fog in the fog range. glFogf(GL_FOG_START, 20.0) glFogf(GL_FOG_END, 60.0)