コード例 #1
0
ファイル: main.py プロジェクト: mbrockman1/smile
    def do_flip(self, block=True):
        # call the flip
        EventLoop.window.dispatch('on_flip')

        # TODO: use sync events instead!
        if block:
            # draw a transparent point
            # position
            glVertexAttribPointer(0, 2, GL_INT, GL_FALSE, 0,
                                  "\x00\x00\x00\x0a\x00\x00\x00\x0a")
            # color
            glVertexAttrib4f(3, 0.0, 0.0, 0.0, 0.0)
            glDrawArrays(GL_POINTS, 0, 1)

            # wait for flip then point to draw
            glFinish()

            # record the time immediately
            self.last_flip = event_time(clock.now(), 0.0)
        else:
            # we didn't block, so set to predicted flip time
            self.last_flip = event_time(self._next_flip_time, 0.0)

        # update flip times
        self._next_flip_time = self.last_flip['time'] + self.flip_interval
        self._next_draw_time = self.last_flip['time'] + self.flip_interval / 2.
        self._did_draw = False

        return self.last_flip
コード例 #2
0
ファイル: main.py プロジェクト: compmem/smile
    def do_flip(self, block=True):
        # call the flip
        EventLoop.window.dispatch('on_flip')

        # TODO: use sync events instead!
        if block:
            # draw a transparent point
            # position
            glVertexAttribPointer(0, 2, GL_INT, GL_FALSE, 0,
                                  "\x00\x00\x00\x0a\x00\x00\x00\x0a")
            # color
            glVertexAttrib4f(3, 0.0, 0.0, 0.0, 0.0)
            glDrawArrays(GL_POINTS, 0, 1)

            # wait for flip then point to draw
            glFinish()

            # record the time immediately
            self.last_flip = event_time(clock.now(), 0.0)
        else:
            # we didn't block, so set to predicted flip time
            self.last_flip = event_time(max(self._next_flip_time, clock.now()), 0.0)

        # update flip times
        self._next_flip_time = self.last_flip['time'] + self.flip_interval
        self._next_draw_time = self.last_flip['time'] + self.flip_interval/2.
        self._did_draw = False

        return self.last_flip
コード例 #3
0
ファイル: experiment.py プロジェクト: beegica/smileDocs
 def blocking_flip(self):
     EventLoop.window.dispatch("on_flip")
     # glEnableVertexAttribArray(0)  # kivy has this enabled already
     glVertexAttribPointer(0, 2, GL_INT, GL_FALSE, 0, "\x00\x00\x00\x0a\x00\x00\x00\x0a")  # Position
     glVertexAttrib4f(3, 0.0, 0.0, 0.0, 0.0)  # Color
     glDrawArrays(GL_POINTS, 0, 1)
     # glDisableVertexAttribArray(0)  # kivy needs this to stay enabled
     glFinish()
     self.last_flip = event_time(clock.now(), 0.0)
     return self.last_flip
コード例 #4
0
ファイル: experiment.py プロジェクト: beegica/smileDocs
 def blocking_flip(self):
     EventLoop.window.dispatch('on_flip')
     #glEnableVertexAttribArray(0)  # kivy has this enabled already
     glVertexAttribPointer(0, 2, GL_INT, GL_FALSE, 0,
                           "\x00\x00\x00\x0a\x00\x00\x00\x0a")  # Position
     glVertexAttrib4f(3, 0.0, 0.0, 0.0, 0.0)  # Color
     glDrawArrays(GL_POINTS, 0, 1)
     #glDisableVertexAttribArray(0)  # kivy needs this to stay enabled
     glFinish()
     self.last_flip = event_time(clock.now(), 0.0)
     return self.last_flip
コード例 #5
0
    def blocking_flip(self):
        # TODO: use sync events instead!
        EventLoop.window.dispatch('on_flip')

        # draw a transparent point
        glVertexAttribPointer(0, 2, GL_INT, GL_FALSE, 0,
                              "\x00\x00\x00\x0a\x00\x00\x00\x0a")  # Position
        glVertexAttrib4f(3, 0.0, 0.0, 0.0, 0.0)  # Color
        glDrawArrays(GL_POINTS, 0, 1)

        # wait for flip and point to draw
        glFinish()

        # record the time immediately
        self.last_flip = event_time(clock.now(), 0.0)
        return self.last_flip