Пример #1
0
def init_gl():
	"""Initializes OpenGL settings."""
	# Enable smooth shading, GL_FLAT enables flat shading
	glShadeModel(GL_SMOOTH)
	# Set the depth value to 1 when the depth buffer is cleared
	glClearDepth(1)
	# Enables depth testing, which eliminates hidden surfaces
	glEnable(GL_DEPTH_TEST)
	# Sets which function to do depth testing with
	# With GL_LEQUAL, any value less than or equal to the depth value in the depth buffer passes
	glDepthFunc(GL_LEQUAL)

	# Use nicest persepctive correction
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)

	# Enables transparency in textures
	glEnable(GL_BLEND)
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

	Fog.init()
	Light.init()