Example #1
0
    def draw(self):
        if self._hidden:
            return

        width, height = self.getMinSize()
        pos = self._getPixelPos()

        scale = 1
        if self._focus:
            scale = 1.05
        if self._disabled:
            glColor4ub(128, 128, 128, 128)
        else:
            if self._focus:
                glColor4ub(5, 15, 30, 200)
            else:
                glColor4ub(5, 15, 30, 255)
        openglHelpers.glDrawQuad(pos[0] - width * scale / 2,
                                 pos[1] - height * scale / 2, width * scale,
                                 height * scale)
        glPushMatrix()
        glTranslatef(pos[0], pos[1] + height * scale / 8, 0)
        glDisable(GL_TEXTURE_2D)
        glColor4ub(255, 255, 255, 255)
        openglHelpers.glDrawStringCenter(self._tooltip)
        glPopMatrix()
Example #2
0
    def OnDraw(self):
        glDisable(GL_LIGHTING)
        glDisable(GL_BLEND)
        glDisable(GL_DEPTH_TEST)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
        glColor3ub(0, 0, 0)
        size = self.parent.getObjectSize()
        radius = self.parent.getObjectBoundaryCircle()
        glPushMatrix()
        glTranslate(0, 0, size[2] / 2 + 5)
        glRotate(-self.parent.yaw, 0, 0, 1)
        if self.parent.pitch < 80:
            glTranslate(0, radius + 5, 0)
        elif self.parent.pitch < 100:
            glTranslate(0, (radius + 5) * (90 - self.parent.pitch) / 10, 0)
        else:
            glTranslate(0, -(radius + 5), 0)
        openglHelpers.glDrawStringCenter("%dx%dx%d" %
                                         (size[0], size[1], size[2]))
        glPopMatrix()

        glColor(255, 255, 255)
        size = size / 2
        glLineWidth(1)
        glBegin(GL_LINES)
        glVertex3f(size[0], size[1], size[2])
        glVertex3f(size[0], size[1], size[2] / 4 * 3)
        glVertex3f(size[0], size[1], size[2])
        glVertex3f(size[0], size[1] / 4 * 3, size[2])
        glVertex3f(size[0], size[1], size[2])
        glVertex3f(size[0] / 4 * 3, size[1], size[2])

        glVertex3f(-size[0], -size[1], size[2])
        glVertex3f(-size[0], -size[1], size[2] / 4 * 3)
        glVertex3f(-size[0], -size[1], size[2])
        glVertex3f(-size[0], -size[1] / 4 * 3, size[2])
        glVertex3f(-size[0], -size[1], size[2])
        glVertex3f(-size[0] / 4 * 3, -size[1], size[2])

        glVertex3f(size[0], -size[1], -size[2])
        glVertex3f(size[0], -size[1], -size[2] / 4 * 3)
        glVertex3f(size[0], -size[1], -size[2])
        glVertex3f(size[0], -size[1] / 4 * 3, -size[2])
        glVertex3f(size[0], -size[1], -size[2])
        glVertex3f(size[0] / 4 * 3, -size[1], -size[2])

        glVertex3f(-size[0], size[1], -size[2])
        glVertex3f(-size[0], size[1], -size[2] / 4 * 3)
        glVertex3f(-size[0], size[1], -size[2])
        glVertex3f(-size[0], size[1] / 4 * 3, -size[2])
        glVertex3f(-size[0], size[1], -size[2])
        glVertex3f(-size[0] / 4 * 3, size[1], -size[2])
        glEnd()
Example #3
0
	def OnDraw(self):
		glDisable(GL_LIGHTING)
		glDisable(GL_BLEND)
		glDisable(GL_DEPTH_TEST)
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
		glColor3ub(0,0,0)
		size = self.parent.getObjectSize()
		radius = self.parent.getObjectBoundaryCircle()
		glPushMatrix()
		glTranslate(0,0,size[2]/2 + 5)
		glRotate(-self.parent.yaw, 0,0,1)
		if self.parent.pitch < 80:
			glTranslate(0, radius + 5,0)
		elif self.parent.pitch < 100:
			glTranslate(0, (radius + 5) * (90 - self.parent.pitch) / 10,0)
		else:
			glTranslate(0,-(radius + 5),0)
		openglHelpers.glDrawStringCenter("%dx%dx%d" % (size[0], size[1], size[2]))
		glPopMatrix()

		glColor(255,255,255)
		size = size / 2
		glLineWidth(1)
		glBegin(GL_LINES)
		glVertex3f(size[0], size[1], size[2])
		glVertex3f(size[0], size[1], size[2]/4*3)
		glVertex3f(size[0], size[1], size[2])
		glVertex3f(size[0], size[1]/4*3, size[2])
		glVertex3f(size[0], size[1], size[2])
		glVertex3f(size[0]/4*3, size[1], size[2])

		glVertex3f(-size[0], -size[1], size[2])
		glVertex3f(-size[0], -size[1], size[2]/4*3)
		glVertex3f(-size[0], -size[1], size[2])
		glVertex3f(-size[0], -size[1]/4*3, size[2])
		glVertex3f(-size[0], -size[1], size[2])
		glVertex3f(-size[0]/4*3, -size[1], size[2])

		glVertex3f(size[0], -size[1], -size[2])
		glVertex3f(size[0], -size[1], -size[2]/4*3)
		glVertex3f(size[0], -size[1], -size[2])
		glVertex3f(size[0], -size[1]/4*3, -size[2])
		glVertex3f(size[0], -size[1], -size[2])
		glVertex3f(size[0]/4*3, -size[1], -size[2])

		glVertex3f(-size[0], size[1], -size[2])
		glVertex3f(-size[0], size[1], -size[2]/4*3)
		glVertex3f(-size[0], size[1], -size[2])
		glVertex3f(-size[0], size[1]/4*3, -size[2])
		glVertex3f(-size[0], size[1], -size[2])
		glVertex3f(-size[0]/4*3, size[1], -size[2])
		glEnd()
	def OnDraw(self):
		if not self._enabled:
			return

		self._resultLock.acquire()
		result = self._result
		if result is not None:
			gcodeLayers = result.getGCodeLayers(self._gcodeLoadCallback)
			if result._polygons is not None and len(result._polygons) > 0:
				self.layerSelect.setRange(1, len(result._polygons))
			elif gcodeLayers is not None and len(gcodeLayers) > 0:
				self.layerSelect.setRange(1, len(gcodeLayers))
		else:
			gcodeLayers = None

		glPushMatrix()
		glEnable(GL_BLEND)
		if profile.getMachineSetting('machine_center_is_zero') != 'True':
			glTranslate(-profile.getMachineSettingFloat('machine_width') / 2, -profile.getMachineSettingFloat('machine_depth') / 2, 0)
		glLineWidth(2)

		layerNr = self.layerSelect.getValue()
		if layerNr == self.layerSelect.getMaxValue() and result is not None and len(result._polygons) > 0:
			layerNr = max(layerNr, len(result._polygons))
		if result is not None and len(result._polygons) > layerNr-1 and 'inset0' in result._polygons[layerNr-1] and len(result._polygons[layerNr-1]['inset0']) > 0 and len(result._polygons[layerNr-1]['inset0'][0]) > 0:
			viewZ = result._polygons[layerNr-1]['inset0'][0][0][2]
		else:
			viewZ = (layerNr - 1) * profile.getProfileSettingFloat('layer_height') + profile.getProfileSettingFloat('bottom_thickness')
		self._parent._viewTarget[2] = viewZ
		msize = max(profile.getMachineSettingFloat('machine_width'), profile.getMachineSettingFloat('machine_depth'))
		lineTypeList = [
			('inset0',     'WALL-OUTER', [1,0,0,1]),
			('insetx',     'WALL-INNER', [0,1,0,1]),
			('openoutline', None,        [1,0,0,1]),
			('skin',       'SKIN',       [1,1,0,1]),
			('infill',     'FILL',       [1,1,0,1]),
			('support',    'SUPPORT',    [0,1,1,1]),
			('skirt',      'SKIRT',      [0,1,1,1]),
			('outline',     None,        [0,0,0,1])
		]
		n = layerNr - 1
		generatedVBO = False
		if result is not None:
			while n >= 0:
				if layerNr - n > 30 and n % 20 == 0 and len(result._polygons) > 0:
					idx = n / 20
					while len(self._layer20VBOs) < idx + 1:
						self._layer20VBOs.append({})
					if result._polygons is not None and n + 20 < len(result._polygons):
						layerVBOs = self._layer20VBOs[idx]
						for typeName, typeNameGCode, color in lineTypeList:
							allow = typeName in result._polygons[n + 19]
							if typeName == 'skirt':
								for i in xrange(0, 20):
									if typeName in result._polygons[n + i]:
										allow = True
							if allow:
								if typeName not in layerVBOs:
									if generatedVBO:
										continue
									polygons = []
									for i in xrange(0, 20):
										if typeName in result._polygons[n + i]:
											polygons += result._polygons[n + i][typeName]
									layerVBOs[typeName] = self._polygonsToVBO_lines(polygons)
									generatedVBO = True

								if not self._singleLayer or n == layerNr - 1:
									glColor4f(color[0]*0.5,color[1]*0.5,color[2]*0.5,color[3])
									layerVBOs[typeName].render()
					n -= 20
				else:
					c = 1.0 - ((layerNr - n) - 1) * 0.05
					c = max(0.5, c)
					while len(self._layerVBOs) < n + 1:
						self._layerVBOs.append({})
					layerVBOs = self._layerVBOs[n]
					if gcodeLayers is not None and ((layerNr - 10 < n < (len(gcodeLayers) - 1)) or len(result._polygons) < 1):
						for typeNamePolygons, typeName, color in lineTypeList:
							if typeName is None:
								continue
							if 'GCODE-' + typeName not in layerVBOs:
								layerVBOs['GCODE-' + typeName] = self._gcodeToVBO_quads(gcodeLayers[n+1:n+2], typeName)

							if not self._singleLayer or n == layerNr - 1:
								glColor4f(color[0]*c,color[1]*c,color[2]*c,color[3])
								layerVBOs['GCODE-' + typeName].render()

						if n == layerNr - 1:
							if 'GCODE-MOVE' not in layerVBOs:
								layerVBOs['GCODE-MOVE'] = self._gcodeToVBO_lines(gcodeLayers[n+1:n+2])
							glColor4f(0,0,c,1)
							layerVBOs['GCODE-MOVE'].render()
					elif n < len(result._polygons):
						polygons = result._polygons[n]
						for typeName, typeNameGCode, color in lineTypeList:
							if typeName in polygons:
								if typeName not in layerVBOs:
									layerVBOs[typeName] = self._polygonsToVBO_lines(polygons[typeName])

								if not self._singleLayer or n == layerNr - 1:
									glColor4f(color[0]*c,color[1]*c,color[2]*c,color[3])
									layerVBOs[typeName].render()
					n -= 1
		glPopMatrix()
		if generatedVBO:
			self._parent._queueRefresh()

		if gcodeLayers is not None and self._gcodeLoadProgress != 0.0 and self._gcodeLoadProgress != 1.0:
			glPushMatrix()
			glLoadIdentity()
			glTranslate(0,-0.8,-2)
			glColor4ub(60,60,60,255)
			openglHelpers.glDrawStringCenter(_("Loading toolpath for visualization (%d%%)") % (self._gcodeLoadProgress * 100))
			glPopMatrix()
		self._resultLock.release()
Example #5
0
	def OnDraw(self):
		if not self._enabled:
			return

		self._resultLock.acquire()
		result = self._result
		if result is not None:
			gcodeLayers = result.getGCodeLayers(self._gcodeLoadCallback)
			if result._polygons is not None and len(result._polygons) > 0:
				self.layerSelect.setRange(1, len(result._polygons))
			elif gcodeLayers is not None and len(gcodeLayers) > 0:
				self.layerSelect.setRange(1, len(gcodeLayers))
		else:
			gcodeLayers = None

		glPushMatrix()
		glEnable(GL_BLEND)
		if profile.getMachineSetting('machine_center_is_zero') != 'True':
			glTranslate(-profile.getMachineSettingFloat('machine_width') / 2, -profile.getMachineSettingFloat('machine_depth') / 2, 0)
		glLineWidth(2)

		layerNr = self.layerSelect.getValue()
		if layerNr == self.layerSelect.getMaxValue() and result is not None and len(result._polygons) > 0:
			layerNr = max(layerNr, len(result._polygons))
		if result is not None and len(result._polygons) > layerNr-1 and 'inset0' in result._polygons[layerNr-1] and len(result._polygons[layerNr-1]['inset0']) > 0 and len(result._polygons[layerNr-1]['inset0'][0]) > 0:
			viewZ = result._polygons[layerNr-1]['inset0'][0][0][2]
		else:
			viewZ = (layerNr - 1) * profile.getProfileSettingFloat('layer_height') + profile.getProfileSettingFloat('bottom_thickness')
		self._parent._viewTarget[2] = viewZ
		msize = max(profile.getMachineSettingFloat('machine_width'), profile.getMachineSettingFloat('machine_depth'))
		lineTypeList = [
			('inset0',     'WALL-OUTER', [1,0,0,1]),
			('insetx',     'WALL-INNER', [0,1,0,1]),
			('openoutline', None,        [1,0,0,1]),
			('skin',       'SKIN',       [1,1,0,1]),
			('infill',     'FILL',       [1,1,0,1]),
			('support',    'SUPPORT',    [0,1,1,1]),
			('skirt',      'SKIRT',      [0,1,1,1]),
			('outline',     None,        [0,0,0,1])
		]
		n = layerNr - 1
		generatedVBO = False
		if result is not None:
			while n >= 0:
				if layerNr - n > 30 and n % 20 == 0 and len(result._polygons) > 0:
					idx = n / 20
					while len(self._layer20VBOs) < idx + 1:
						self._layer20VBOs.append({})
					if result._polygons is not None and n + 20 < len(result._polygons):
						layerVBOs = self._layer20VBOs[idx]
						for typeName, typeNameGCode, color in lineTypeList:
							allow = typeName in result._polygons[n + 19]
							if typeName == 'skirt':
								for i in xrange(0, 20):
									if typeName in result._polygons[n + i]:
										allow = True
							if allow:
								if typeName not in layerVBOs:
									if generatedVBO:
										continue
									polygons = []
									for i in xrange(0, 20):
										if typeName in result._polygons[n + i]:
											polygons += result._polygons[n + i][typeName]
									layerVBOs[typeName] = self._polygonsToVBO_lines(polygons)
									generatedVBO = True
								glColor4f(color[0]*0.5,color[1]*0.5,color[2]*0.5,color[3])
								layerVBOs[typeName].render()
					n -= 20
				else:
					c = 1.0 - ((layerNr - n) - 1) * 0.05
					c = max(0.5, c)
					while len(self._layerVBOs) < n + 1:
						self._layerVBOs.append({})
					layerVBOs = self._layerVBOs[n]
					if gcodeLayers is not None and ((layerNr - 10 < n < (len(gcodeLayers) - 1)) or len(result._polygons) < 1):
						for typeNamePolygons, typeName, color in lineTypeList:
							if typeName is None:
								continue
							if 'GCODE-' + typeName not in layerVBOs:
								layerVBOs['GCODE-' + typeName] = self._gcodeToVBO_quads(gcodeLayers[n+1:n+2], typeName)
							glColor4f(color[0]*c,color[1]*c,color[2]*c,color[3])
							layerVBOs['GCODE-' + typeName].render()

						if n == layerNr - 1:
							if 'GCODE-MOVE' not in layerVBOs:
								layerVBOs['GCODE-MOVE'] = self._gcodeToVBO_lines(gcodeLayers[n+1:n+2])
							glColor4f(0,0,c,1)
							layerVBOs['GCODE-MOVE'].render()
					elif n < len(result._polygons):
						polygons = result._polygons[n]
						for typeName, typeNameGCode, color in lineTypeList:
							if typeName in polygons:
								if typeName not in layerVBOs:
									layerVBOs[typeName] = self._polygonsToVBO_lines(polygons[typeName])
								glColor4f(color[0]*c,color[1]*c,color[2]*c,color[3])
								layerVBOs[typeName].render()
					n -= 1
		glPopMatrix()
		if generatedVBO:
			self._parent._queueRefresh()

		if gcodeLayers is not None and self._gcodeLoadProgress != 0.0 and self._gcodeLoadProgress != 1.0:
			glPushMatrix()
			glLoadIdentity()
			glTranslate(0,-0.8,-2)
			glColor4ub(60,60,60,255)
			openglHelpers.glDrawStringCenter(_("Loading toolpath for visualization (%d%%)") % (self._gcodeLoadProgress * 100))
			glPopMatrix()
		self._resultLock.release()
Example #6
0
    def draw(self):
        if self._hidden:
            return

        cx = (self._imageID % 4) / 4
        cy = int(self._imageID / 4) / 4
        bs = self.getMinSize()[0]
        pos = self._getPixelPos()

        glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
        scale = 0.8
        if self._selected:
            scale = 1.0
        elif self._focus:
            scale = 0.9
        if self._disabled:
            glColor4ub(128, 128, 128, 128)
        else:
            glColor4ub(255, 255, 255, 255)
        openglHelpers.glDrawTexturedQuad(pos[0] - bs * scale / 2,
                                         pos[1] - bs * scale / 2, bs * scale,
                                         bs * scale, 1)
        openglHelpers.glDrawTexturedQuad(pos[0] - bs * scale / 2,
                                         pos[1] - bs * scale / 2, bs * scale,
                                         bs * scale, self._imageID)
        if self._showExpandArrow:
            if self._selected:
                openglHelpers.glDrawTexturedQuad(
                    pos[0] + bs * scale / 2 - bs * scale / 4 * 1.2,
                    pos[1] - bs * scale / 2 * 1.2, bs * scale / 4,
                    bs * scale / 4, 1)
            else:
                openglHelpers.glDrawTexturedQuad(
                    pos[0] + bs * scale / 2 - bs * scale / 4 * 1.2,
                    pos[1] - bs * scale / 2 * 1.2, bs * scale / 4,
                    bs * scale / 4, 1, 2)
        glPushMatrix()
        glTranslatef(pos[0], pos[1], 0)
        glDisable(GL_TEXTURE_2D)
        if self._focus:
            glTranslatef(0, -0.55 * bs * scale, 0)

            glPushMatrix()
            glColor4ub(150, 0, 0, 10)
            glTranslatef(-1, -1, 0)
            openglHelpers.glDrawStringCenter(self._tooltip)
            glTranslatef(0, 2, 0)
            openglHelpers.glDrawStringCenter(self._tooltip)
            glTranslatef(2, 0, 0)
            openglHelpers.glDrawStringCenter(self._tooltip)
            glTranslatef(0, -2, 0)
            openglHelpers.glDrawStringCenter(self._tooltip)
            glPopMatrix()

            glColor4ub(10, 10, 10, 255)
            openglHelpers.glDrawStringCenter(self._tooltip)
        glPopMatrix()
        progress = self._progressBar
        if progress is not None:
            glColor4ub(60, 60, 60, 255)
            openglHelpers.glDrawQuad(pos[0] - bs / 2, pos[1] + bs / 2, bs,
                                     bs / 4)
            glColor4ub(255, 255, 255, 255)
            openglHelpers.glDrawQuad(pos[0] - bs / 2 + 2, pos[1] + bs / 2 + 2,
                                     (bs - 5) * progress + 1, bs / 4 - 4)
        elif len(self._altTooltip) > 0:
            glPushMatrix()
            glTranslatef(pos[0], pos[1], 0)
            glTranslatef(0, 0.6 * bs, 0)
            glTranslatef(0, 6, 0)
            #glTranslatef(0.6*bs*scale, 0, 0)

            for line in self._altTooltip.split('\n'):
                glPushMatrix()
                glColor4ub(60, 60, 60, 255)
                glTranslatef(-1, -1, 0)
                openglHelpers.glDrawStringCenter(line)
                glTranslatef(0, 2, 0)
                openglHelpers.glDrawStringCenter(line)
                glTranslatef(2, 0, 0)
                openglHelpers.glDrawStringCenter(line)
                glTranslatef(0, -2, 0)
                openglHelpers.glDrawStringCenter(line)
                glPopMatrix()

                glColor4ub(255, 255, 255, 255)
                openglHelpers.glDrawStringCenter(line)
                glTranslatef(0, 18, 0)
            glPopMatrix()
Example #7
0
	def OnDraw(self):
		s = self._nodeSize()
		sx = s*15
		sy = s*15
		sz = s*15
		if self.node == 2 and self.scale is not None:
			sx *= self.scale
		if self.node == 3 and self.scale is not None:
			sy *= self.scale
		if self.node == 4 and self.scale is not None:
			sz *= self.scale
		objMatrix = self.parent.getObjectMatrix()
		scaleX = numpy.linalg.norm(objMatrix[::,0].getA().flatten())
		scaleY = numpy.linalg.norm(objMatrix[::,1].getA().flatten())
		scaleZ = numpy.linalg.norm(objMatrix[::,2].getA().flatten())
		if self.scale is not None:
			scaleX *= self.scale
			scaleY *= self.scale
			scaleZ *= self.scale

		glDisable(GL_LIGHTING)
		glDisable(GL_DEPTH_TEST)
		glEnable(GL_BLEND)
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

		glColor3ub(0,0,0)
		size = self.parent.getObjectSize()
		radius = self.parent.getObjectBoundaryCircle()
		if self.scale is not None:
			radius *= self.scale
		glPushMatrix()
		glTranslate(0,0,size[2]/2 + 5)
		glRotate(-self.parent._yaw, 0,0,1)
		if self.parent._pitch < 80:
			glTranslate(0, radius + 5,0)
		elif self.parent._pitch < 100:
			glTranslate(0, (radius + 5) * (90 - self.parent._pitch) / 10,0)
		else:
			glTranslate(0,-(radius + 5),0)
		if self.parent.tempMatrix is not None:
			size = (numpy.matrix([size]) * self.parent.tempMatrix).getA().flatten()
		openglHelpers.glDrawStringCenter("W, D, H: %0.1f, %0.1f, %0.1f mm" % (size[0], size[1], size[2]))
		glPopMatrix()

		glLineWidth(1)
		glBegin(GL_LINES)
		glColor3ub(128,0,0)
		glVertex3f(0, 0, 0)
		glVertex3f(sx, 0, 0)
		glColor3ub(0,128,0)
		glVertex3f(0, 0, 0)
		glVertex3f(0, sy, 0)
		glColor3ub(0,0,128)
		glVertex3f(0, 0, 0)
		glVertex3f(0, 0, sz)
		glEnd()

		glLineWidth(2)
		if self.node == 1:
			glColor3ub(255,255,255)
		else:
			glColor3ub(192,192,192)
		openglHelpers.DrawBox([-s,-s,-s], [s,s,s])
		if self.node == 1:
			glColor3ub(0,0,0)
			openglHelpers.glDrawStringCenter("%0.2f" % ((scaleX + scaleY + scaleZ) / 3.0))

		if self.node == 2:
			glColor3ub(255,64,64)
		else:
			glColor3ub(128,0,0)
		glPushMatrix()
		glTranslatef(sx,0,0)
		openglHelpers.DrawBox([-s,-s,-s], [s,s,s])
		if self.node == 2:
			glColor3ub(0,0,0)
			openglHelpers.glDrawStringCenter("%0.2f" % (scaleX))
		glPopMatrix()
		if self.node == 3:
			glColor3ub(64,255,64)
		else:
			glColor3ub(0,128,0)
		glPushMatrix()
		glTranslatef(0,sy,0)
		openglHelpers.DrawBox([-s,-s,-s], [s,s,s])
		if self.node == 3:
			glColor3ub(0,0,0)
			openglHelpers.glDrawStringCenter("%0.2f" % (scaleY))
		glPopMatrix()
		if self.node == 4:
			glColor3ub(64,64,255)
		else:
			glColor3ub(0,0,128)
		glPushMatrix()
		glTranslatef(0,0,sz)
		openglHelpers.DrawBox([-s,-s,-s], [s,s,s])
		if self.node == 4:
			glColor3ub(0,0,0)
			openglHelpers.glDrawStringCenter("%0.2f" % (scaleZ))
		glPopMatrix()

		glEnable(GL_DEPTH_TEST)
		glColor(255,255,255)
		size = size / 2
		size += 0.01
		glLineWidth(1)
		glBegin(GL_LINES)
		glVertex3f(size[0], size[1], size[2])
		glVertex3f(size[0], size[1], size[2]/4*3)
		glVertex3f(size[0], size[1], size[2])
		glVertex3f(size[0], size[1]/4*3, size[2])
		glVertex3f(size[0], size[1], size[2])
		glVertex3f(size[0]/4*3, size[1], size[2])

		glVertex3f(-size[0], size[1], size[2])
		glVertex3f(-size[0], size[1], size[2]/4*3)
		glVertex3f(-size[0], size[1], size[2])
		glVertex3f(-size[0], size[1]/4*3, size[2])
		glVertex3f(-size[0], size[1], size[2])
		glVertex3f(-size[0]/4*3, size[1], size[2])

		glVertex3f(size[0], -size[1], size[2])
		glVertex3f(size[0], -size[1], size[2]/4*3)
		glVertex3f(size[0], -size[1], size[2])
		glVertex3f(size[0], -size[1]/4*3, size[2])
		glVertex3f(size[0], -size[1], size[2])
		glVertex3f(size[0]/4*3, -size[1], size[2])

		glVertex3f(-size[0], -size[1], size[2])
		glVertex3f(-size[0], -size[1], size[2]/4*3)
		glVertex3f(-size[0], -size[1], size[2])
		glVertex3f(-size[0], -size[1]/4*3, size[2])
		glVertex3f(-size[0], -size[1], size[2])
		glVertex3f(-size[0]/4*3, -size[1], size[2])

		glVertex3f(size[0], size[1], -size[2])
		glVertex3f(size[0], size[1], -size[2]/4*3)
		glVertex3f(size[0], size[1], -size[2])
		glVertex3f(size[0], size[1]/4*3, -size[2])
		glVertex3f(size[0], size[1], -size[2])
		glVertex3f(size[0]/4*3, size[1], -size[2])

		glVertex3f(-size[0], size[1], -size[2])
		glVertex3f(-size[0], size[1], -size[2]/4*3)
		glVertex3f(-size[0], size[1], -size[2])
		glVertex3f(-size[0], size[1]/4*3, -size[2])
		glVertex3f(-size[0], size[1], -size[2])
		glVertex3f(-size[0]/4*3, size[1], -size[2])

		glVertex3f(size[0], -size[1], -size[2])
		glVertex3f(size[0], -size[1], -size[2]/4*3)
		glVertex3f(size[0], -size[1], -size[2])
		glVertex3f(size[0], -size[1]/4*3, -size[2])
		glVertex3f(size[0], -size[1], -size[2])
		glVertex3f(size[0]/4*3, -size[1], -size[2])

		glVertex3f(-size[0], -size[1], -size[2])
		glVertex3f(-size[0], -size[1], -size[2]/4*3)
		glVertex3f(-size[0], -size[1], -size[2])
		glVertex3f(-size[0], -size[1]/4*3, -size[2])
		glVertex3f(-size[0], -size[1], -size[2])
		glVertex3f(-size[0]/4*3, -size[1], -size[2])
		glEnd()

		glEnable(GL_DEPTH_TEST)
Example #8
0
	def OnDraw(self):
		glDisable(GL_LIGHTING)
		glDisable(GL_BLEND)
		glDisable(GL_DEPTH_TEST)
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
		radius = self.parent.getObjectBoundaryCircle()
		glScalef(self.rotateRingDist * radius, self.rotateRingDist * radius, self.rotateRingDist * radius)
		if self.dragPlane == 'XY':
			glLineWidth(3)
			glColor4ub(255,64,64,255)
			if self.dragStartAngle is not None:
				glPushMatrix()
				glRotate(self.dragStartAngle, 0,0,1)
				glBegin(GL_LINES)
				glVertex3f(0,0,0)
				glVertex3f(1,0,0)
				glEnd()
				glPopMatrix()
				glPushMatrix()
				glRotate(self.dragEndAngle, 0,0,1)
				glBegin(GL_LINES)
				glVertex3f(0,0,0)
				glVertex3f(1,0,0)
				glEnd()
				glTranslatef(1.1,0,0)
				glColor4ub(0,0,0,255)
				openglHelpers.glDrawStringCenter("%d" % (abs(self.dragEndAngle - self.dragStartAngle) + 0.5))
				glColor4ub(255,64,64,255)
				glPopMatrix()
		else:
			glLineWidth(1)
			glColor4ub(128,0,0,255)
		glBegin(GL_LINE_LOOP)
		for i in xrange(0, 64):
			glVertex3f(math.cos(i/32.0*math.pi), math.sin(i/32.0*math.pi),0)
		glEnd()
		if self.dragPlane == 'YZ':
			glColor4ub(64,255,64,255)
			glLineWidth(3)
			if self.dragStartAngle is not None:
				glPushMatrix()
				glRotate(self.dragStartAngle, 1,0,0)
				glBegin(GL_LINES)
				glVertex3f(0,0,0)
				glVertex3f(0,1,0)
				glEnd()
				glPopMatrix()
				glPushMatrix()
				glRotate(self.dragEndAngle, 1,0,0)
				glBegin(GL_LINES)
				glVertex3f(0,0,0)
				glVertex3f(0,1,0)
				glEnd()
				glTranslatef(0,1.1,0)
				glColor4ub(0,0,0,255)
				openglHelpers.glDrawStringCenter("%d" % (abs(self.dragEndAngle - self.dragStartAngle)))
				glColor4ub(64,255,64,255)
				glPopMatrix()
		else:
			glColor4ub(0,128,0,255)
			glLineWidth(1)
		glBegin(GL_LINE_LOOP)
		for i in xrange(0, 64):
			glVertex3f(0, math.cos(i/32.0*math.pi), math.sin(i/32.0*math.pi))
		glEnd()
		if self.dragPlane == 'XZ':
			glLineWidth(3)
			glColor4ub(255,255,0,255)
			if self.dragStartAngle is not None:
				glPushMatrix()
				glRotate(self.dragStartAngle, 0,-1,0)
				glBegin(GL_LINES)
				glVertex3f(0,0,0)
				glVertex3f(1,0,0)
				glEnd()
				glPopMatrix()
				glPushMatrix()
				glRotate(self.dragEndAngle, 0,-1,0)
				glBegin(GL_LINES)
				glVertex3f(0,0,0)
				glVertex3f(1,0,0)
				glEnd()
				glTranslatef(1.1,0,0)
				glColor4ub(0,0,0,255)
				openglHelpers.glDrawStringCenter("%d" % (round(abs(self.dragEndAngle - self.dragStartAngle))))
				glColor4ub(255,255,0,255)
				glPopMatrix()
		else:
			glColor4ub(128,128,0,255)
			glLineWidth(1)
		glBegin(GL_LINE_LOOP)
		for i in xrange(0, 64):
			glVertex3f(math.cos(i/32.0*math.pi), 0, math.sin(i/32.0*math.pi))
		glEnd()
		glEnable(GL_DEPTH_TEST)
Example #9
0
    def OnDraw(self):
        s = self._nodeSize()
        sx = s * 15
        sy = s * 15
        sz = s * 15
        if self.node == 2 and self.scale is not None:
            sx *= self.scale
        if self.node == 3 and self.scale is not None:
            sy *= self.scale
        if self.node == 4 and self.scale is not None:
            sz *= self.scale
        objMatrix = self.parent.getObjectMatrix()
        scaleX = numpy.linalg.norm(objMatrix[::, 0].getA().flatten())
        scaleY = numpy.linalg.norm(objMatrix[::, 1].getA().flatten())
        scaleZ = numpy.linalg.norm(objMatrix[::, 2].getA().flatten())
        if self.scale is not None:
            scaleX *= self.scale
            scaleY *= self.scale
            scaleZ *= self.scale

        glDisable(GL_LIGHTING)
        glDisable(GL_DEPTH_TEST)
        glEnable(GL_BLEND)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

        glColor3ub(0, 0, 0)
        size = self.parent.getObjectSize()
        radius = self.parent.getObjectBoundaryCircle()
        if self.scale is not None:
            radius *= self.scale
        glPushMatrix()
        glTranslate(0, 0, size[2] / 2 + 5)
        glRotate(-self.parent._yaw, 0, 0, 1)
        if self.parent._pitch < 80:
            glTranslate(0, radius + 5, 0)
        elif self.parent._pitch < 100:
            glTranslate(0, (radius + 5) * (90 - self.parent._pitch) / 10, 0)
        else:
            glTranslate(0, -(radius + 5), 0)
        if self.parent.tempMatrix is not None:
            size = (numpy.matrix([size]) *
                    self.parent.tempMatrix).getA().flatten()
        openglHelpers.glDrawStringCenter("W, D, H: %0.1f, %0.1f, %0.1f mm" %
                                         (size[0], size[1], size[2]))
        glPopMatrix()

        glLineWidth(1)
        glBegin(GL_LINES)
        glColor3ub(128, 0, 0)
        glVertex3f(0, 0, 0)
        glVertex3f(sx, 0, 0)
        glColor3ub(0, 128, 0)
        glVertex3f(0, 0, 0)
        glVertex3f(0, sy, 0)
        glColor3ub(0, 0, 128)
        glVertex3f(0, 0, 0)
        glVertex3f(0, 0, sz)
        glEnd()

        glLineWidth(2)
        if self.node == 1:
            glColor3ub(255, 255, 255)
        else:
            glColor3ub(192, 192, 192)
        openglHelpers.DrawBox([-s, -s, -s], [s, s, s])
        if self.node == 1:
            glColor3ub(0, 0, 0)
            openglHelpers.glDrawStringCenter(
                "%0.2f" % ((scaleX + scaleY + scaleZ) / 3.0))

        if self.node == 2:
            glColor3ub(255, 64, 64)
        else:
            glColor3ub(128, 0, 0)
        glPushMatrix()
        glTranslatef(sx, 0, 0)
        openglHelpers.DrawBox([-s, -s, -s], [s, s, s])
        if self.node == 2:
            glColor3ub(0, 0, 0)
            openglHelpers.glDrawStringCenter("%0.2f" % (scaleX))
        glPopMatrix()
        if self.node == 3:
            glColor3ub(64, 255, 64)
        else:
            glColor3ub(0, 128, 0)
        glPushMatrix()
        glTranslatef(0, sy, 0)
        openglHelpers.DrawBox([-s, -s, -s], [s, s, s])
        if self.node == 3:
            glColor3ub(0, 0, 0)
            openglHelpers.glDrawStringCenter("%0.2f" % (scaleY))
        glPopMatrix()
        if self.node == 4:
            glColor3ub(64, 64, 255)
        else:
            glColor3ub(0, 0, 128)
        glPushMatrix()
        glTranslatef(0, 0, sz)
        openglHelpers.DrawBox([-s, -s, -s], [s, s, s])
        if self.node == 4:
            glColor3ub(0, 0, 0)
            openglHelpers.glDrawStringCenter("%0.2f" % (scaleZ))
        glPopMatrix()

        glEnable(GL_DEPTH_TEST)
        glColor(255, 255, 255)
        size = size / 2
        size += 0.01
        glLineWidth(1)
        glBegin(GL_LINES)
        glVertex3f(size[0], size[1], size[2])
        glVertex3f(size[0], size[1], size[2] / 4 * 3)
        glVertex3f(size[0], size[1], size[2])
        glVertex3f(size[0], size[1] / 4 * 3, size[2])
        glVertex3f(size[0], size[1], size[2])
        glVertex3f(size[0] / 4 * 3, size[1], size[2])

        glVertex3f(-size[0], size[1], size[2])
        glVertex3f(-size[0], size[1], size[2] / 4 * 3)
        glVertex3f(-size[0], size[1], size[2])
        glVertex3f(-size[0], size[1] / 4 * 3, size[2])
        glVertex3f(-size[0], size[1], size[2])
        glVertex3f(-size[0] / 4 * 3, size[1], size[2])

        glVertex3f(size[0], -size[1], size[2])
        glVertex3f(size[0], -size[1], size[2] / 4 * 3)
        glVertex3f(size[0], -size[1], size[2])
        glVertex3f(size[0], -size[1] / 4 * 3, size[2])
        glVertex3f(size[0], -size[1], size[2])
        glVertex3f(size[0] / 4 * 3, -size[1], size[2])

        glVertex3f(-size[0], -size[1], size[2])
        glVertex3f(-size[0], -size[1], size[2] / 4 * 3)
        glVertex3f(-size[0], -size[1], size[2])
        glVertex3f(-size[0], -size[1] / 4 * 3, size[2])
        glVertex3f(-size[0], -size[1], size[2])
        glVertex3f(-size[0] / 4 * 3, -size[1], size[2])

        glVertex3f(size[0], size[1], -size[2])
        glVertex3f(size[0], size[1], -size[2] / 4 * 3)
        glVertex3f(size[0], size[1], -size[2])
        glVertex3f(size[0], size[1] / 4 * 3, -size[2])
        glVertex3f(size[0], size[1], -size[2])
        glVertex3f(size[0] / 4 * 3, size[1], -size[2])

        glVertex3f(-size[0], size[1], -size[2])
        glVertex3f(-size[0], size[1], -size[2] / 4 * 3)
        glVertex3f(-size[0], size[1], -size[2])
        glVertex3f(-size[0], size[1] / 4 * 3, -size[2])
        glVertex3f(-size[0], size[1], -size[2])
        glVertex3f(-size[0] / 4 * 3, size[1], -size[2])

        glVertex3f(size[0], -size[1], -size[2])
        glVertex3f(size[0], -size[1], -size[2] / 4 * 3)
        glVertex3f(size[0], -size[1], -size[2])
        glVertex3f(size[0], -size[1] / 4 * 3, -size[2])
        glVertex3f(size[0], -size[1], -size[2])
        glVertex3f(size[0] / 4 * 3, -size[1], -size[2])

        glVertex3f(-size[0], -size[1], -size[2])
        glVertex3f(-size[0], -size[1], -size[2] / 4 * 3)
        glVertex3f(-size[0], -size[1], -size[2])
        glVertex3f(-size[0], -size[1] / 4 * 3, -size[2])
        glVertex3f(-size[0], -size[1], -size[2])
        glVertex3f(-size[0] / 4 * 3, -size[1], -size[2])
        glEnd()

        glEnable(GL_DEPTH_TEST)
Example #10
0
 def OnDraw(self):
     glDisable(GL_LIGHTING)
     glDisable(GL_BLEND)
     glDisable(GL_DEPTH_TEST)
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
     radius = self.parent.getObjectBoundaryCircle()
     glScalef(self.rotateRingDist * radius, self.rotateRingDist * radius,
              self.rotateRingDist * radius)
     if self.dragPlane == 'XY':
         glLineWidth(3)
         glColor4ub(255, 64, 64, 255)
         if self.dragStartAngle is not None:
             glPushMatrix()
             glRotate(self.dragStartAngle, 0, 0, 1)
             glBegin(GL_LINES)
             glVertex3f(0, 0, 0)
             glVertex3f(1, 0, 0)
             glEnd()
             glPopMatrix()
             glPushMatrix()
             glRotate(self.dragEndAngle, 0, 0, 1)
             glBegin(GL_LINES)
             glVertex3f(0, 0, 0)
             glVertex3f(1, 0, 0)
             glEnd()
             glTranslatef(1.1, 0, 0)
             glColor4ub(0, 0, 0, 255)
             openglHelpers.glDrawStringCenter(
                 "%d" %
                 (abs(self.dragEndAngle - self.dragStartAngle) + 0.5))
             glColor4ub(255, 64, 64, 255)
             glPopMatrix()
     else:
         glLineWidth(1)
         glColor4ub(128, 0, 0, 255)
     glBegin(GL_LINE_LOOP)
     for i in xrange(0, 64):
         glVertex3f(math.cos(i / 32.0 * math.pi),
                    math.sin(i / 32.0 * math.pi), 0)
     glEnd()
     if self.dragPlane == 'YZ':
         glColor4ub(64, 255, 64, 255)
         glLineWidth(3)
         if self.dragStartAngle is not None:
             glPushMatrix()
             glRotate(self.dragStartAngle, 1, 0, 0)
             glBegin(GL_LINES)
             glVertex3f(0, 0, 0)
             glVertex3f(0, 1, 0)
             glEnd()
             glPopMatrix()
             glPushMatrix()
             glRotate(self.dragEndAngle, 1, 0, 0)
             glBegin(GL_LINES)
             glVertex3f(0, 0, 0)
             glVertex3f(0, 1, 0)
             glEnd()
             glTranslatef(0, 1.1, 0)
             glColor4ub(0, 0, 0, 255)
             openglHelpers.glDrawStringCenter(
                 "%d" % (abs(self.dragEndAngle - self.dragStartAngle)))
             glColor4ub(64, 255, 64, 255)
             glPopMatrix()
     else:
         glColor4ub(0, 128, 0, 255)
         glLineWidth(1)
     glBegin(GL_LINE_LOOP)
     for i in xrange(0, 64):
         glVertex3f(0, math.cos(i / 32.0 * math.pi),
                    math.sin(i / 32.0 * math.pi))
     glEnd()
     if self.dragPlane == 'XZ':
         glLineWidth(3)
         glColor4ub(255, 255, 0, 255)
         if self.dragStartAngle is not None:
             glPushMatrix()
             glRotate(self.dragStartAngle, 0, -1, 0)
             glBegin(GL_LINES)
             glVertex3f(0, 0, 0)
             glVertex3f(1, 0, 0)
             glEnd()
             glPopMatrix()
             glPushMatrix()
             glRotate(self.dragEndAngle, 0, -1, 0)
             glBegin(GL_LINES)
             glVertex3f(0, 0, 0)
             glVertex3f(1, 0, 0)
             glEnd()
             glTranslatef(1.1, 0, 0)
             glColor4ub(0, 0, 0, 255)
             openglHelpers.glDrawStringCenter(
                 "%d" %
                 (round(abs(self.dragEndAngle - self.dragStartAngle))))
             glColor4ub(255, 255, 0, 255)
             glPopMatrix()
     else:
         glColor4ub(128, 128, 0, 255)
         glLineWidth(1)
     glBegin(GL_LINE_LOOP)
     for i in xrange(0, 64):
         glVertex3f(math.cos(i / 32.0 * math.pi), 0,
                    math.sin(i / 32.0 * math.pi))
     glEnd()
     glEnable(GL_DEPTH_TEST)
Example #11
0
	def draw(self):
		if self._hidden:
			return

		cx = (self._imageID % 4) / 4
		cy = int(self._imageID / 4) / 4
		bs = self.getMinSize()[0]
		pos = self._getPixelPos()

		glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
		#button sizing		
		scale = 1.0
		if self._selected:
			scale = 1.0
		elif self._focus:
			scale = 1.0
		if self._disabled:
			glColor4ub(128,128,128,128)
		else:
			glColor4ub(255,255,255,255)
		openglHelpers.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, 0)
		openglHelpers.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, self._imageID)
		if self._showExpandArrow:
			if self._selected:
				openglHelpers.glDrawTexturedQuad(pos[0]+bs*scale/2-bs*scale/4*1.2, pos[1]-bs*scale/2*1.2, bs*scale/4, bs*scale/4, 1)
			else:
				openglHelpers.glDrawTexturedQuad(pos[0]+bs*scale/2-bs*scale/4*1.2, pos[1]-bs*scale/2*1.2, bs*scale/4, bs*scale/4, 1, 2)
		glPushMatrix()
		glTranslatef(pos[0], pos[1], 0)
		glDisable(GL_TEXTURE_2D)
		'''if self._focus:
			glTranslatef(0, -0.55*bs*scale, 0)

			glPushMatrix()
			glColor4ub(60,60,60,255)
			glTranslatef(-1, -1, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(0, 2, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(2, 0, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(0, -2, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glPopMatrix()

			glColor4ub(255,255,255,255)
			openglHelpers.glDrawStringCenter(self._tooltip)
		'''
		glPopMatrix()
		progress = self._progressBar
		if progress is not None:
			glColor4ub(60,60,60,255)
			openglHelpers.glDrawQuad(pos[0]-bs/2, pos[1]+bs/2, bs, bs / 4)
			glColor4ub(255,255,255,255)
			openglHelpers.glDrawQuad(pos[0]-bs/2+2, pos[1]+bs/2+2, (bs - 5) * progress + 1, bs / 4 - 4)
		elif len(self._altTooltip) > 0:
			glPushMatrix()
			glTranslatef(pos[0], pos[1], 0)
			glTranslatef(0, 0.6*bs, 0)
			glTranslatef(0, 6, 0)
			#glTranslatef(0.6*bs*scale, 0, 0)

			for line in self._altTooltip.split('\n'):
				glPushMatrix()
				glColor4ub(60,60,60,255)
				glTranslatef(-1, -1, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, 2, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(2, 0, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, -2, 0)
				openglHelpers.glDrawStringCenter(line)
				glPopMatrix()

				glColor4ub(255,255,255,255)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, 18, 0)
			glPopMatrix()
Example #12
0
	def draw(self):
		# if self._hidden: #Comment by dagoma
		# 	return
		try :

			cx = (self._imageID % 4) / 4
			cy = int(self._imageID / 4) / 4
		except :
			pass
		bs = self.getMinSize()[0]
		pos = self._getPixelPos()

		glBindTexture(GL_TEXTURE_2D, self._base._glButtonsTexture)
		scale = 0.8
		if self._selected:
			scale = 1.0
		elif self._focus:
			scale = 0.9
		if self._disabled:
			glColor4ub(128,128,128,128)
		else:
			glColor4ub(255,255,255,255)
		openglHelpers.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, 0)
		try :
			openglHelpers.glDrawTexturedQuad(pos[0]-bs*scale/2, pos[1]-bs*scale/2, bs*scale, bs*scale, self._imageID)
		except :
			pass
		if self._showExpandArrow:
			if self._selected:
				openglHelpers.glDrawTexturedQuad(pos[0]+bs*scale/2-bs*scale/4*1.2, pos[1]-bs*scale/2*1.2, bs*scale/4, bs*scale/4, 1)
			else:
				openglHelpers.glDrawTexturedQuad(pos[0]+bs*scale/2-bs*scale/4*1.2, pos[1]-bs*scale/2*1.2, bs*scale/4, bs*scale/4, 1, 2)
		glPushMatrix()
		glTranslatef(pos[0], pos[1], 0)
		glDisable(GL_TEXTURE_2D)
		if self._focus:
			glTranslatef(0, -0.55*bs*scale, 0)

			glPushMatrix()
			glColor4ub(60,60,60,255)
			glTranslatef(-1, -1, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(0, 2, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(2, 0, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glTranslatef(0, -2, 0)
			openglHelpers.glDrawStringCenter(self._tooltip)
			glPopMatrix()

			glColor4ub(255,255,255,255)
			openglHelpers.glDrawStringCenter(self._tooltip)
		glPopMatrix()
		progress = self._progressBar
		if progress is not None:
			bs = 64 #Add by dagoma
			glColor4ub(60,60,60,255)
			openglHelpers.glDrawQuad(pos[0]-bs/2, pos[1]+bs/2, bs, bs / 4)
			glColor4ub(255,255,255,255)
			openglHelpers.glDrawQuad(pos[0]-bs/2+2, pos[1]+bs/2+2, (bs - 5) * progress + 1, bs / 4 - 4)
		elif len(self._altTooltip) > 0:
			glPushMatrix()
			glTranslatef(pos[0], pos[1], 0)
			split_tooltip = self._altTooltip.split('\n')
			if self._imageID is None:
				max_line = ''
				for line in split_tooltip:
					if len(line) > len(max_line):
						max_line = line
				#print self._base._buttonSize
				tooltip_translate_x = (self._base._buttonSize - openglHelpers.glGetStringSize(max_line)[0]) / 2
				tooltip_translate_y = 0
				if not self._base._buttonSize == 32:
					tooltip_translate_y = self._base._buttonSize - (len(split_tooltip) + 1) * 18 + (6 - self._base._buttonSize / 16) * 4
				elif len(split_tooltip) > 2:
					tooltip_translate_y = - 18 * (len(split_tooltip) - 2) - 4
				else:
					tooltip_translate_y = -4
				glTranslatef(tooltip_translate_x, tooltip_translate_y, 0)
				#glTranslatef(0.6*bs*scale, 0, 0)
			else:
				glTranslatef(0, 0.6*bs, 0)
				glTranslatef(0, 6, 0)
				#glTranslatef(0.6*bs*scale, 0, 0)

			for line in split_tooltip:
				glPushMatrix()
				glColor4ub(60,60,60,255)
				glTranslatef(-1, -1, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, 2, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(2, 0, 0)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, -2, 0)
				openglHelpers.glDrawStringCenter(line)
				glPopMatrix()

				glColor4ub(255,255,255,255)
				openglHelpers.glDrawStringCenter(line)
				glTranslatef(0, 18, 0)
			glPopMatrix()