Beispiel #1
0
	win = pyglet.window.Window(width=640, height=640, resizable=True, visible=False,
		config=pyglet.gl.Config(sample_buffers=1, samples=4, double_buffer=True, depth_size=24))

	glEnable(GL_LIGHTING)
	glEnable(GL_LIGHT0)
	fourfv = ctypes.c_float * 4
	glLightfv(GL_LIGHT0, GL_POSITION, fourfv(-250, 250, 500, 1.0))
	glLightfv(GL_LIGHT0, GL_AMBIENT, fourfv(0.1, 0.1, 0.1, 1.0))
	glLightfv(GL_LIGHT0, GL_DIFFUSE, fourfv(0.9, 0.9, 0.9, 1.0))
	glLightfv(GL_LIGHT0, GL_SPECULAR, fourfv(1.5, 1.5, 1.5, 1.0))
	glEnable(GL_COLOR_MATERIAL)
	glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE)
	glMaterialfv(GL_FRONT, GL_SPECULAR, fourfv(1.0, 1.0, 1.0, 1.0))
	glMateriali(GL_FRONT, GL_SHININESS, 128)

	noisetex = ShaderNoiseTexture()
	noisetex.load()
	noisetex.enable()

	quadratic = gluNewQuadric()
	gluQuadricNormals(quadratic, GLU_SMOOTH)
	glEnable(GL_CULL_FACE)
	yrot = spin = 0.0
	xrot = 90.0

	# Setup shader state
	simple_bump_prog.install()
	simple_bump_prog.uset1F('scale', 1.0)
	simple_bump_prog.uset1F('height', 0.045)

	crinkle_prog.install()
Beispiel #2
0
if __name__ == '__main__':
	import sys
	global xrot, yrot, d
	win = pyglet.window.Window(width=640, height=640, resizable=True, visible=False,
		config=pyglet.gl.Config(sample_buffers=1, samples=4, double_buffer=True, depth_size=24))

	glEnable(GL_LIGHTING)
	glEnable(GL_LIGHT0)
	fourfv = ctypes.c_float * 4
	glLightfv(GL_LIGHT0, GL_POSITION, fourfv(1, 0, 1.0, -0.5))
	glLightfv(GL_LIGHT0, GL_AMBIENT, fourfv(0.001, 0.001, 0.001, 1.0))
	glLightfv(GL_LIGHT0, GL_DIFFUSE, fourfv(2.0, 2.0, 2.0, 1.0))
	glEnable(GL_COLOR_MATERIAL)
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

	noisetex = ShaderNoiseTexture()
	noisetex.load()
	

	earth_texture = pyglet.image.load(
		os.path.join(os.path.dirname(__file__), "earth.1024x512.jpg")).get_mipmapped_texture()
	glTexParameteri(earth_texture.target, GL_TEXTURE_WRAP_S, GL_REPEAT)
	glTexParameteri(earth_texture.target, GL_TEXTURE_WRAP_T, GL_REPEAT)
	glTexParameteri(earth_texture.target, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
	glTexParameteri(earth_texture.target, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
	glEnable(earth_texture.target)

	earth = gluNewQuadric()
	gluQuadricNormals(earth, GLU_SMOOTH)
	gluQuadricTexture(earth, GL_TRUE)
	glEnable(GL_CULL_FACE)