Exemple #1
0
    def render_cli(self):
        glPushMatrix()
        glTranslatef(-self.zoom * .094 * self.width,
                     -self.zoom * .094 * self.height, 400.0)

        glColor4f(0.5, 0.5, 1.0, 0.4)
        x0 = -self.zoom * .0023 * self.width
        y0 = -self.zoom * .0023 * self.height  # bottom left corner
        x1 = self.zoom * .065 * self.width  # width
        y1 = self.zoom * .19 * self.height  # height

        glBegin(GL_QUADS)
        glVertex3f(x0, y0, -1)
        glVertex3f(x1, y0, -1)
        glVertex3f(x1, y1, -1)
        glVertex3f(x0, y1, -1)
        glEnd()

        glColor4f(0.0, 0.0, 0.0, 1.0)
        screen_text = self.text[-100:]
        for text in screen_text:
            if text[0] == 'c':
                if text[1][:len(self.prompt)] != self.prompt:
                    text[1] = self.prompt + text[1]
        i = 0
        for text in reversed(screen_text):
            text = text[1]
            if len(text) <= self.max_line_chr:
                glPushMatrix()
                display.text_at_pos(0,
                                    self.zoom * i * 3,
                                    0,
                                    text,
                                    font=GLUT_BITMAP_9_BY_15)
                glPopMatrix()
                i += 1
            else:
                tmp = []
                for j in range(0, len(text), self.max_line_chr):
                    segment = text[j:j + self.max_line_chr]
                    n = self.max_line_chr - len(segment)
                    for _ in range(n):
                        segment += ' '
                    tmp.append(segment)
                tmp.reverse()
                for c in tmp:
                    glPushMatrix()
                    display.text_at_pos(0,
                                        self.zoom * i * 3,
                                        0,
                                        c,
                                        font=GLUT_BITMAP_9_BY_15)
                    glPopMatrix()
                    i += 1
        glPopMatrix()
Exemple #2
0
    def draw(self):
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

        glPushMatrix()

        #looking at x/y plane - down z axis
        glTranslatef(self.transX, self.transY, self.transZ)

        glRotatef(self.angleY, 0.0, 1.0, 0.0)
        glRotatef(self.angleX, 1.0, 0.0, 0.0)

        if config.floor_on:
            self.room.render()

        glColor3f(0, 0, 0)
        #display.draw_axes(20, '1')

        self.robot.render()

        glPopMatrix()

        # reference axis
        glPushMatrix()

        glTranslatef(self.zoom * .07 * self.width,
                     self.zoom * .07 * self.height, 400.0)

        glRotatef(self.angleY, 0.0, 1.0, 0.0)
        glRotatef(self.angleX, 1.0, 0.0, 0.0)
        display.draw_axes(self.zoom * 13, '')

        glPopMatrix()

        if self.aux_msg_enabled:
            glPushMatrix()
            glTranslatef(-self.zoom * .094 * self.width,
                         -self.zoom * .094 * self.height, 400.0)
            glColor4f(0.0, 0.0, 0.0, 1.0)
            glPushMatrix()
            display.text_at_pos(0,
                                self.zoom * 1 * 3,
                                0,
                                self.aux_msg,
                                font=GLUT_BITMAP_9_BY_15)
            glPopMatrix()
            glPopMatrix()

        if not self.hide_cli:
            self.render_cli()

        glutSwapBuffers()
Exemple #3
0
 def render_cli(self):
     glPushMatrix()
     glTranslatef(-self.zoom*.094*self.width, -self.zoom*.094*self.height, 400.0)
     
     glColor4f(0.5, 0.5, 1.0, 0.4)
     x0 = -self.zoom*.0023*self.width
     y0 = -self.zoom*.0023*self.height # bottom left corner
     x1 = self.zoom*.065*self.width # width
     y1 = self.zoom*.19*self.height # height
     
     glBegin(GL_QUADS)
     glVertex3f(x0, y0, -1)
     glVertex3f(x1, y0, -1)
     glVertex3f(x1, y1, -1)
     glVertex3f(x0, y1, -1)
     glEnd()
     
     glColor4f(0.0, 0.0, 0.0, 1.0)
     screen_text = self.text[-100:]
     for text in screen_text:
         if text[0] == 'c':
             if text[1][:len(self.prompt)] != self.prompt:
                 text[1] = self.prompt + text[1]
     i = 0
     for text in reversed(screen_text):
         text = text[1]
         if len(text) <= self.max_line_chr:
             glPushMatrix()
             display.text_at_pos(0, self.zoom*i*3, 0, text, font=GLUT_BITMAP_9_BY_15)
             glPopMatrix()
             i += 1
         else:
             tmp = []
             for j in range(0, len(text), self.max_line_chr):
                 segment = text[j:j + self.max_line_chr]
                 n = self.max_line_chr - len(segment)
                 for _ in range(n):
                     segment += ' '
                 tmp.append(segment)
             tmp.reverse()
             for c in tmp:
                 glPushMatrix()
                 display.text_at_pos(0, self.zoom*i*3, 0, c, font=GLUT_BITMAP_9_BY_15)
                 glPopMatrix()
                 i += 1
     glPopMatrix()
Exemple #4
0
    def draw(self):
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
        
        glPushMatrix()
        
        #looking at x/y plane - down z axis
        glTranslatef(self.transX, self.transY, self.transZ)
        
        glRotatef(self.angleY, 0.0, 1.0, 0.0)
        glRotatef(self.angleX, 1.0, 0.0, 0.0)
        
        if config.floor_on:
            self.room.render()
        
        glColor3f(0, 0, 0)
        #display.draw_axes(20, '1')
        
        self.robot.render()
        
        glPopMatrix()

        # reference axis
        glPushMatrix()

        glTranslatef(self.zoom*.07*self.width, self.zoom*.07*self.height, 400.0)

        glRotatef(self.angleY, 0.0, 1.0, 0.0)
        glRotatef(self.angleX, 1.0, 0.0, 0.0)
        display.draw_axes(self.zoom*13, '')
        
        glPopMatrix()
        
        if self.aux_msg_enabled:
            glPushMatrix()
            glTranslatef(-self.zoom*.094*self.width, -self.zoom*.094*self.height, 400.0)
            glColor4f(0.0, 0.0, 0.0, 1.0)
            glPushMatrix()
            display.text_at_pos(0, self.zoom*1*3, 0, self.aux_msg, font=GLUT_BITMAP_9_BY_15)
            glPopMatrix()
            glPopMatrix()
    
        if not self.hide_cli:
            self.render_cli()
        
        glutSwapBuffers()