コード例 #1
0
ファイル: boat.py プロジェクト: maverick7170/Navigator
    def draw(self):
        with srh.GLMatrix:
            srh.rotate_to_body(self.body)

            q = gluNewQuadric()
            with srh.GLMatrix:
                glTranslate(+.2, 0, 0)
                glColor3f(0, 1, 0)
                gluSphere(q, 0.5, 40, 20)
            with srh.GLMatrix:
                glTranslate(-.2, 0, 0)
                glColor3f(1, 0, 0)
                gluSphere(q, 0.5, 40, 20)
            with srh.GLMatrix:
                glTranslate(+.4, -.2, +.3)
                glColor3f(0, 0, 0)
                gluSphere(q, 0.1, 40, 20)
            with srh.GLMatrix:
                glTranslate(+.4, +.2, +.3)
                glColor3f(0, 0, 0)
                gluSphere(q, 0.1, 40, 20)
            with srh.GLMatrix:
                glTranslate(0, 0, +.5)
                glColor3f(0, 1, 0)
                gluSphere(q, 0.1, 20, 10)

            glDisable(GL_DEPTH_TEST)
            glBegin(GL_LINES)
            for start, end in self.vectors:
                glColor3f(0, 0, 0)
                glVertex3f(*start)
                glColor3f(1, 1, 1)
                glVertex3f(*end)
            glEnd()
            glEnable(GL_DEPTH_TEST)
コード例 #2
0
ファイル: boat.py プロジェクト: pchojecki/RobotX
 def draw(self):
     with srh.GLMatrix:
         srh.rotate_to_body(self.body)
         
         q = gluNewQuadric()
         with srh.GLMatrix:
             glTranslate(+.2, 0, 0)
             glColor3f(0, 1, 0)
             gluSphere(q, 0.5, 40, 20)
         with srh.GLMatrix:
             glTranslate(-.2, 0, 0)
             glColor3f(1, 0, 0)
             gluSphere(q, 0.5, 40, 20)
         with srh.GLMatrix:
             glTranslate(+.4, -.2, +.3)
             glColor3f(0, 0, 0)
             gluSphere(q, 0.1, 40, 20)
         with srh.GLMatrix:
             glTranslate(+.4, +.2, +.3)
             glColor3f(0, 0, 0)
             gluSphere(q, 0.1, 40, 20)
         with srh.GLMatrix:
             glTranslate(0, 0, +.5)
             glColor3f(0, 1, 0)
             gluSphere(q, 0.1, 20, 10)
         
         glDisable(GL_DEPTH_TEST)
         glBegin(GL_LINES)
         for start, end in self.vectors:
             glColor3f(0, 0, 0)
             glVertex3f(*start)
             glColor3f(1, 1, 1)
             glVertex3f(*end)
         glEnd()
         glEnable(GL_DEPTH_TEST)
コード例 #3
0
ファイル: sim.py プロジェクト: pchojecki/RobotX
def set_forward_view():
    glTranslate(-1, 0, -1)
    srh.rotate_to_body(body, inv=True)
コード例 #4
0
ファイル: sim.py プロジェクト: maverick7170/Navigator
def set_forward_view():
    glTranslate(-1, 0, -1)
    srh.rotate_to_body(body, inv=True)