docs: def create_3d_texture(width, scale):
  	"""Create a grayscale 3d texture map with the specified 
  	pixel width on each side and load it into the current texture
  	unit. The luminace of each texel is derived using the input 
  	function as:
  
  	v = func(x * scale, y * scale, z * scale)
  
  	where x, y, z = 0 in the center texel of the texture.
  	func(x, y, z) is assumed to always return a value in the 
  	range [-1, 1].
  	"""
  	coords = range(width)
  	texel = (ctypes.c_byte * width**3)()
  	half = 0 #width * scale / 2.0 
  
  	for z in coords:
  		for y in coords:
  			for x in coords:
  				v = snoise3(x * scale - half, y * scale - half, z * scale - half, octaves=4, persistence=0.25)
  				texel[x + (y * width) + (z * width**2)] = int(v * 127.0)
  	glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
  	glTexImage3D(GL_TEXTURE_3D, 0, GL_LUMINANCE, width, width, width, 0, 
  		GL_LUMINANCE, GL_BYTE, ctypes.byref(texel))
  	return texel