def _drawGui(self): if self._glButtonsTexture is None: self._glButtonsTexture = opengl.loadGLTexture('glButtons.png') self._glRobotTexture = opengl.loadGLTexture('Sawers3Dfoot.png') glDisable(GL_DEPTH_TEST) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glDisable(GL_LIGHTING) glColor4ub(255, 255, 255, 255) glMatrixMode(GL_PROJECTION) glLoadIdentity() size = self.GetSize() glOrtho(0, size.GetWidth() - 1, size.GetHeight() - 1, 0, -1000.0, 1000.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() self._container.draw() glBindTexture(GL_TEXTURE_2D, self._glRobotTexture) # glEnable(GL_TEXTURE_2D) # glPushMatrix() # glColor4f(1,1,1,1) # glTranslate(size.GetWidth(),size.GetHeight(),0) # s = self._buttonSize * 1 # glScale(s,s,s) # glTranslate(-1.2,-0.2,0) # glBegin(GL_QUADS) # glTexCoord2f(1, 0) # glVertex2f(0,-1) # glTexCoord2f(0, 0) # glVertex2f(-1,-1) # glTexCoord2f(0, 1) # glVertex2f(-1, 0) # glTexCoord2f(1, 1) # glVertex2f(0, 0) # glEnd() # glDisable(GL_TEXTURE_2D) glPopMatrix()
def _drawGui(self): if self._glButtonsTexture is None: self._glButtonsTexture = opengl.loadGLTexture('glButtons.png') self._glRobotTexture = opengl.loadGLTexture('UltimakerRobot.png') glDisable(GL_DEPTH_TEST) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) glDisable(GL_LIGHTING) glColor4ub(255,255,255,255) glMatrixMode(GL_PROJECTION) glLoadIdentity() size = self.GetSize() glOrtho(0, size.GetWidth()-1, size.GetHeight()-1, 0, -1000.0, 1000.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() self._container.draw() # glBindTexture(GL_TEXTURE_2D, self._glRobotTexture) # glEnable(GL_TEXTURE_2D) # glPushMatrix() # glColor4f(1,1,1,1) # glTranslate(size.GetWidth(),size.GetHeight(),0) # s = self._buttonSize * 1 # glScale(s,s,s) # glTranslate(-1.2,-0.2,0) # glBegin(GL_QUADS) # glTexCoord2f(1, 0) # glVertex2f(0,-1) # glTexCoord2f(0, 0) # glVertex2f(-1,-1) # glTexCoord2f(0, 1) # glVertex2f(-1, 0) # glTexCoord2f(1, 1) # glVertex2f(0, 0) # glEnd() # glDisable(GL_TEXTURE_2D) glPopMatrix()
def _drawGui(self): if self._glButtonsTexture is None: self._glButtonsTexture = opengl.loadGLTexture('glButtons.png') self._glRobotTexture = opengl.loadGLTexture('UltimakerRobot.png') glDisable(GL_DEPTH_TEST) glEnable(GL_BLEND) glDisable(GL_LIGHTING) glColor4ub(255, 255, 255, 255) glMatrixMode(GL_PROJECTION) glLoadIdentity() size = self.GetSize() glOrtho(0, size.GetWidth() - 1, size.GetHeight() - 1, 0, -1000.0, 1000.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() self._container.draw() glBindTexture(GL_TEXTURE_2D, self._glRobotTexture) glEnable(GL_TEXTURE_2D) glPushMatrix() glColor4f(1, 1, 1, 1) glTranslate(size.GetWidth() - 8, size.GetHeight() - 16, 0) s = self._buttonSize * 1.4 glScale(s, s, s) glBegin(GL_QUADS) glTexCoord2f(1, 0) glVertex2f(0, -1) glTexCoord2f(0, 0) glVertex2f(-1, -1) glTexCoord2f(0, 1) glVertex2f(-1, 0) glTexCoord2f(1, 1) glVertex2f(0, 0) glEnd() glDisable(GL_TEXTURE_2D) glPopMatrix()
def _drawGui(self): if self._glButtonsTexture is None: self._glButtonsTexture = opengl.loadGLTexture('glButtons.png') glDisable(GL_DEPTH_TEST) glEnable(GL_BLEND) glDisable(GL_LIGHTING) glColor4ub(255,255,255,255) glMatrixMode(GL_PROJECTION) glLoadIdentity() size = self.GetSize() glOrtho(0, size.GetWidth()-1, size.GetHeight()-1, 0, -1000.0, 1000.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() self._container.draw()
def _drawGui(self): if self._glButtonsTexture is None: self._glButtonsTexture = opengl.loadGLTexture('glButtons.png') glDisable(GL_DEPTH_TEST) glEnable(GL_BLEND) glDisable(GL_LIGHTING) glColor4ub(255, 255, 255, 255) glMatrixMode(GL_PROJECTION) glLoadIdentity() size = self.GetSize() glOrtho(0, size.GetWidth() - 1, size.GetHeight() - 1, 0, -1000.0, 1000.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() self._container.draw()
def draw(self): if self._hidden: return if self._parent._glButtonsTexture is None: self._parent._glButtonsTexture = opengl.loadGLTexture('glButtons.png') cx = (self._imageID % 4) / 4 cy = int(self._imageID / 4) / 4 bs = self._parent._buttonSize pos = self._getPixelPos() glPushMatrix() glTranslatef(pos[0], pos[1], 0) glBindTexture(GL_TEXTURE_2D, self._parent._glButtonsTexture) glEnable(GL_TEXTURE_2D) scale = 0.8 if self._selected: scale = 1.0 elif self._focus: scale = 0.9 glScalef(bs * scale, bs * scale, bs * scale) glColor4ub(255,255,255,255) glBegin(GL_QUADS) glTexCoord2f(cx+0.25, cy) glVertex2f( 0.5,-0.5) glTexCoord2f(cx, cy) glVertex2f(-0.5,-0.5) glTexCoord2f(cx, cy+0.25) glVertex2f(-0.5, 0.5) glTexCoord2f(cx+0.25, cy+0.25) glVertex2f( 0.5, 0.5) glEnd() glDisable(GL_TEXTURE_2D) if self._focus: glColor4ub(0,0,0,255) glTranslatef(0, -0.55, 0) opengl.glDrawStringCenter(self._tooltip) glPopMatrix()