예제 #1
0
	def render_led(self, led, color):

		# as a very basic quad for now!
		glPushMatrix()
		glTranslatef(led['x'], led['y'], self.config['size']['thickness']/2.0 + 0.1)  # 0.1mm in front of front face
		Renderer.quad(color, led['w'], led['h'])
		glPopMatrix()
예제 #2
0
	def render(self):

		# Render front
		glPushMatrix()
		glTranslatef(0,0, self.config['size']['thickness']/2.0)
		Renderer.textured_quad(self.front, self.config['size']['width'], self.config['size']['height'])
		glPopMatrix()

		# Render back
		glPushMatrix()
		glTranslatef(0,0, -self.config['size']['thickness']/2.0)
		glRotatef( 180.0, 0.0, 1.0, 0.0) # 180 degree spin around the vertical axis
		Renderer.textured_quad(self.back, self.config['size']['width'], self.config['size']['height'])
		glPopMatrix()

		# Render top
		glPushMatrix()
		glTranslatef(0, self.config['size']['height']/2.0, 0.0)
		glRotatef( 90.0, 1.0, 0.0, 0.0) # 90 degree spin around the horizontal axis
		Renderer.quad(self.config['color'], self.config['size']['width'], self.config['size']['thickness'])
		glPopMatrix()

		# Render bottom
		glPushMatrix()
		glTranslatef(0, -self.config['size']['height']/2.0, 0.0)
		glRotatef( 90.0, 1.0, 0.0, 0.0) # 90 degree spin around the horizontal axis
		Renderer.quad(self.config['color'], self.config['size']['width'], self.config['size']['thickness'])
		glPopMatrix()

		# Render left
		glPushMatrix()
		glTranslatef(-self.config['size']['width']/2., 0, 0)
		glRotatef( 90.0, 0.0, 1.0, 0.0) # 90 degree spin around the vertical axis
		Renderer.quad(self.config['color'], self.config['size']['thickness'], self.config['size']['height'])
		glPopMatrix()

		# Render right
		glPushMatrix()
		glTranslatef(self.config['size']['width']/2., 0, 0)
		glRotatef( 90.0, 0.0, 1.0, 0.0) # 90 degree spin around the vertical axis
		Renderer.quad(self.config['color'], self.config['size']['thickness'], self.config['size']['height'])
		glPopMatrix()

		# Render LEDs
		for led in self.config['leds']:
			self.render_led(led, self.colors[led['id']])