Пример #1
0
    def __init__(self, parent):
        # OpenGL Widget setup
        f = QGLFormat()
        f.setSampleBuffers(True)
        f.setVersion(3,3)
        f.setProfile(QGLFormat.CoreProfile)
        QGLFormat.setDefaultFormat(f)

        if not QGLFormat.hasOpenGL():
            QMessageBox.information(None, "OpenGL samplebuffers",
                    "This system does not support OpenGL.")
            sys.exit(0)
        super(GLWidget, self).__init__(f, parent)
        self.setFocusPolicy(Qt.StrongFocus)
        self.list_ = []
        self.width = 640.0
        self.height = 480.0
        self.startTimer(40)
        self.setWindowTitle("Sample Buffers")
        self.fov = 60.0
        self.deltaTime = 0.0
        self.lastFrame = None
        self.sketching = False
        self.sketchType = 0
        self.sketchPoints = []
Пример #2
0
def start(mode):
    # Install message handler for Qt messages
    qInstallMessageHandler(gui_msg_handler)

    # Start the Qt main object
    app = QApplication([])

    # Start the bluesky network client
    client = GuiClient()

    # Enable HiDPI support (Qt5 only)
    if QT_VERSION >= 0x050000:
        app.setAttribute(Qt.AA_UseHighDpiPixmaps)

    splash = Splash()

    # Register our custom pan/zoom event
    for etype in range(1000, 1000 + NUMCUSTOMEVENTS):
        reg_etype = QEvent.registerEventType(etype)
        if reg_etype != etype:
            print(('Warning: Registered event type differs from requested type id (%d != %d)' % (reg_etype, etype)))

    splash.show()

    # Install error message handler
    handler = QErrorMessage.qtHandler()
    handler.setWindowFlags(Qt.WindowStaysOnTopHint)

    # Check and set OpenGL capabilities
    if not QGLFormat.hasOpenGL():
        raise RuntimeError('No OpenGL support detected for this system!')
    else:
        f = QGLFormat()
        f.setVersion(3, 3)
        f.setProfile(QGLFormat.CoreProfile)
        f.setDoubleBuffer(True)
        QGLFormat.setDefaultFormat(f)
        print(('QGLWidget initialized for OpenGL version %d.%d' % (f.majorVersion(), f.minorVersion())))

    splash.showMessage('Constructing main window')
    app.processEvents()
    win = MainWindow(mode)
    win.show()
    splash.showMessage('Done!')
    app.processEvents()
    splash.finish(win)
    # If this instance of the gui is started in client-only mode, show
    # server selection dialog
    if mode == 'client':
        dialog = DiscoveryDialog(win)
        dialog.show()
        bs.net.start_discovery()

    else:
        client.connect(event_port=bs.settings.event_port,
                       stream_port=bs.settings.stream_port)

    # Start the Qt main loop
    app.exec_()
Пример #3
0
def start():
    # Start the Qt main object
    app = QApplication([])

    # Start the bluesky network client
    client = GuiClient()

    # Enable HiDPI support (Qt5 only)
    if QT_VERSION >= 0x050000:
        app.setAttribute(Qt.AA_UseHighDpiPixmaps)

    splash = Splash()

    # Register our custom pan/zoom event
    for etype in range(1000, 1000 + NUMCUSTOMEVENTS):
        reg_etype = QEvent.registerEventType(etype)
        if reg_etype != etype:
            print((
                'Warning: Registered event type differs from requested type id (%d != %d)'
                % (reg_etype, etype)))

    splash.show()

    # Install error message handler
    handler = QErrorMessage.qtHandler()
    handler.setWindowFlags(Qt.WindowStaysOnTopHint)

    # Check and set OpenGL capabilities
    if not QGLFormat.hasOpenGL():
        raise RuntimeError('No OpenGL support detected for this system!')
    else:
        f = QGLFormat()
        f.setVersion(3, 3)
        f.setProfile(QGLFormat.CoreProfile)
        f.setDoubleBuffer(True)
        QGLFormat.setDefaultFormat(f)
        print(('QGLWidget initialized for OpenGL version %d.%d' %
               (f.majorVersion(), f.minorVersion())))

    splash.showMessage('Constructing main window')
    app.processEvents()
    win = MainWindow()
    win.show()
    splash.showMessage('Done!')
    app.processEvents()
    splash.finish(win)
    # If this instance of the gui is started in client-only mode, show
    # server selection dialog
    if bs.settings.is_client:
        dialog = DiscoveryDialog(win)
        dialog.show()
        bs.net.start_discovery()

    else:
        client.connect(event_port=bs.settings.event_port,
                       stream_port=bs.settings.stream_port)

    # Start the Qt main loop
    app.exec_()
Пример #4
0
    def __init__(self, parent=None):
        self.first = True
        f = QGLFormat()
        f.setVersion(3, 3)
        f.setProfile(QGLFormat.CoreProfile)
        f.setDoubleBuffer(True)
        QGLWidget.__init__(self, QGLContext(f), parent)

        print(('QGLWidget initialized for OpenGL version %d.%d' % (f.majorVersion(), f.minorVersion())))

        print("This script creates a file called 'opengl-test.txt', containing information about the opengl support of your computer. Useful when debugging problems with the opengl version of BlueSky.")
Пример #5
0
    def __init__(self, parent=None):
        self.first = True
        f = QGLFormat()
        f.setVersion(3, 3)
        f.setProfile(QGLFormat.OpenGLContextProfile.CoreProfile)
        f.setDoubleBuffer(True)
        QGLWidget.__init__(self, QGLContext(f), parent)

        print(('QGLWidget initialized for OpenGL version %d.%d' % (f.majorVersion(), f.minorVersion())))

        print("This script creates a file called 'opengl-test.txt', containing information about the opengl support of your computer. Useful when debugging problems with the opengl version of BlueSky.")
Пример #6
0
 def __init__(self, renderer, title):
     QApplication.__init__(self, sys.argv)
     self.window = QMainWindow()
     self.window.setWindowTitle(title)
     self.window.resize(800,600)
     # Get OpenGL 4.1 context
     glformat = QGLFormat()
     glformat.setVersion(4, 1)
     glformat.setProfile(QGLFormat.CoreProfile)
     glformat.setDoubleBuffer(False)
     self.glwidget = MyGlWidget(renderer, glformat, self)
     self.window.setCentralWidget(self.glwidget)
     self.window.show()
Пример #7
0
    def __init__(self):
        super(Gui, self).__init__([])
        self.acdata = ACDataEvent()
        self.birddata = BirdDataEvent()
        self.navdb = None
        self.radarwidget = []
        self.command_history = []
        self.cmd = ''
        self.args = []
        self.history_pos = 0
        self.command_mem = ''
        self.command_line = ''
        self.prev_cmdline = ''
        self.mousedragged = False
        self.mousepos = (0, 0)
        self.prevmousepos = (0, 0)
        self.panzoomchanged = False
        self.simt = 0.0

        # Register our custom pan/zoom event
        for etype in range(1000, 1000 + NUMEVENTS):
            reg_etype = QEvent.registerEventType(etype)
            if reg_etype != etype:
                print(
                    'Warning: Registered event type differs from requested type id (%d != %d)'
                    % (reg_etype, etype))

        self.splash = Splash()
        self.splash.show()

        # Install error message handler
        handler = QErrorMessage.qtHandler()
        handler.setWindowFlags(Qt.WindowStaysOnTopHint)

        # Check and set OpenGL capabilities
        if not QGLFormat.hasOpenGL():
            raise RuntimeError('No OpenGL support detected for this system!')
        else:
            f = QGLFormat()
            f.setVersion(3, 3)
            f.setProfile(QGLFormat.CoreProfile)
            f.setDoubleBuffer(True)
            QGLFormat.setDefaultFormat(f)
            print('QGLWidget initialized for OpenGL version %d.%d' %
                  (f.majorVersion(), f.minorVersion()))

        # Enable HiDPI support (Qt5 only)
        if QT_VERSION == 5:
            self.setAttribute(Qt.AA_UseHighDpiPixmaps)
Пример #8
0
    def __init__(self):
        super(Gui, self).__init__([])
        self.acdata          = ACDataEvent()
        self.routedata       = RouteDataEvent()
        self.navdb           = None
        self.radarwidget     = []
        self.command_history = []
        self.cmd             = ''
        self.args            = []
        self.history_pos     = 0
        self.command_mem     = ''
        self.command_line    = ''
        self.prev_cmdline    = ''
        self.mousedragged    = False
        self.mousepos        = (0, 0)
        self.prevmousepos    = (0, 0)
        self.panzoomchanged  = False
        self.simt            = 0.0

        # Register our custom pan/zoom event
        for etype in range(1000, 1000 + NUMEVENTS):
            reg_etype = QEvent.registerEventType(etype)
            if reg_etype != etype:
                print('Warning: Registered event type differs from requested type id (%d != %d)' % (reg_etype, etype))

        self.splash = Splash()
        self.splash.show()

        # Install error message handler
        handler = QErrorMessage.qtHandler()
        handler.setWindowFlags(Qt.WindowStaysOnTopHint)

        # Check and set OpenGL capabilities
        if not QGLFormat.hasOpenGL():
            raise RuntimeError('No OpenGL support detected for this system!')
        else:
            f = QGLFormat()
            f.setVersion(3, 3)
            f.setProfile(QGLFormat.CoreProfile)
            f.setDoubleBuffer(True)
            QGLFormat.setDefaultFormat(f)
            print('QGLWidget initialized for OpenGL version %d.%d' % (f.majorVersion(), f.minorVersion()))

        # Enable HiDPI support (Qt5 only)
        if QT_VERSION == 5:
            self.setAttribute(Qt.AA_UseHighDpiPixmaps)
Пример #9
0
    def __init__(self):
        super(StimCanvas, self).__init__()

        self.control = TrialControl()
        self.control.show()
        self.t = time.time()
        glformat = QGLFormat()
        glformat.setVersion(4, 1)
        glformat.setProfile(QGLFormat.CoreProfile)

        glformat.setDoubleBuffer(True)
        self.drawtimer = QTimer(self)
        self.drawtimer.timeout.connect(self.update)
        self.drawtimer.start(1000 / 60)
        self.curframe = 0
        self.curtrial = 0

        self.trial_seq = [0]
Пример #10
0
    def initWindow(self):
        self.window = MainWindow(self)
        self.window.setWindowTitle('CS791a')

        glFormat = QGLFormat()
        glFormat.setDoubleBuffer(True)
        glFormat.setDirectRendering(True)
        glFormat.setProfile(QGLFormat.CoreProfile)
        glFormat.setVersion(3,3)
        QGLFormat.setDefaultFormat(glFormat)

        #glFormat.setOption(QGLFormat.OpenGL_Version_3_3)

        self.graphics = GraphicsManager(self)
        self.graphics.makeCurrent()
        self.window.setCentralWidget(self.graphics)
        self.window.resize(1600,900)

        print(glGetString(GL_VERSION))
Пример #11
0
            self.selValues[4] += int(val) * increment
            self.remainder = val - int(val)

        self.update_lcd()
        if self.btn_pressed is not None:
            QTimer.singleShot(200, self.updateAPValues)


if __name__ == "__main__":
    qapp = QApplication([])

    # Check and set OpenGL capabilities
    if not QGLFormat.hasOpenGL():
        raise RuntimeError('No OpenGL support detected for this system!')
    else:
        f = QGLFormat()
        f.setVersion(3, 3)
        f.setProfile(QGLFormat.CoreProfile)
        f.setDoubleBuffer(True)
        QGLFormat.setDefaultFormat(f)
        print(('QGLWidget initialized for OpenGL version %d.%d' % (f.majorVersion(), f.minorVersion())))

    blip = BlipDriver()
    blip.show()

    gltimer          = QTimer(qapp)
    gltimer.timeout.connect(blip.updateGL)
    gltimer.start(50)

    qapp.exec_()
Пример #12
0
class Video():
    """Mupen64Plus video extension"""
    def __init__(self):
        """Constructor."""
        self.parent = None
        self.widget = None
        self.glformat = None
        self.glcontext = None
        self.major = None
        self.minor = None

    def set_widget(self, parent):
        """Sets GL widget."""
        self.parent = parent
        self.widget = self.parent.glwidget

    def init(self):
        """Initialize GL context."""
        if not self.glcontext:
            self.glformat = QGLFormat()
            self.glcontext = self.widget.context()
            self.glcontext.setFormat(self.glformat)
            self.glcontext.create()
        return M64ERR_SUCCESS

    def quit(self):
        """Shuts down the video system."""
        if self.glcontext:
            self.glcontext.doneCurrent()
            self.glcontext = None
        return M64ERR_SUCCESS

    def list_fullscreen_modes(self, size_array, num_sizes):
        """Enumerates the available resolutions
        for fullscreen video modes."""
        num_sizes.contents.value = len(MODES)
        for num, mode in enumerate(MODES):
            width, height = mode
            size_array[num].uiWidth = width
            size_array[num].uiHeight = height
        return M64ERR_SUCCESS

    def set_video_mode(self, width, height, bits, mode):
        """Creates a rendering window."""
        self.glcontext.makeCurrent()
        if self.glcontext.isValid():
            if glimport:
                GL.glClearColor(0.0, 0.0, 0.0, 1.0)
                GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
                self.widget.swapBuffers()
                GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
            return M64ERR_SUCCESS
        else:
            return M64ERR_SYSTEM_FAIL

    def set_caption(self, title):
        """Sets the caption text of the
        emulator rendering window. """
        title = "M64Py :: %s" % title.decode()
        self.parent.set_caption.emit(title)
        return M64ERR_SUCCESS

    def toggle_fs(self):
        """Toggles between fullscreen and
        windowed rendering modes. """
        self.widget.toggle_fs.emit()
        return M64ERR_SUCCESS

    def gl_get_proc(self, proc):
        """Used to get a pointer to
        an OpenGL extension function."""
        addr = self.glcontext.getProcAddress(proc.decode())
        if addr is not None:
            return addr.__int__()
        else:
            log.warn("VidExtFuncGLGetProc: '%s'" % proc.decode())

    def gl_set_attr(self, attr, value):
        """Sets OpenGL attributes."""
        attr_map = {
            M64P_GL_DOUBLEBUFFER: self.glformat.setDoubleBuffer,
            M64P_GL_BUFFER_SIZE: self.glformat.setDepthBufferSize,
            M64P_GL_DEPTH_SIZE: self.glformat.setDepth,
            M64P_GL_RED_SIZE: self.glformat.setRedBufferSize,
            M64P_GL_GREEN_SIZE: self.glformat.setGreenBufferSize,
            M64P_GL_BLUE_SIZE: self.glformat.setBlueBufferSize,
            M64P_GL_ALPHA_SIZE: self.glformat.setAlphaBufferSize,
            M64P_GL_SWAP_CONTROL: self.glformat.setSwapInterval,
            M64P_GL_MULTISAMPLEBUFFERS: self.glformat.setSampleBuffers,
            M64P_GL_MULTISAMPLESAMPLES: self.glformat.setSamples,
            M64P_GL_CONTEXT_MAJOR_VERSION: self.set_major,
            M64P_GL_CONTEXT_MINOR_VERSION: self.set_minor,
            M64P_GL_CONTEXT_PROFILE_MASK: self.glformat.setProfile
        }
        set_attr = attr_map[attr]
        set_attr(value)
        if attr == M64P_GL_CONTEXT_MAJOR_VERSION or attr == M64P_GL_CONTEXT_MINOR_VERSION:
            if self.major and self.minor:
                self.glformat.setVersion(self.major, self.minor)
        return M64ERR_SUCCESS

    def gl_get_attr(self, attr, value):
        """Gets OpenGL attributes."""
        attr_map = {
            M64P_GL_DOUBLEBUFFER: self.glformat.doubleBuffer,
            M64P_GL_BUFFER_SIZE: self.glformat.depthBufferSize,
            M64P_GL_DEPTH_SIZE: self.glformat.depth,
            M64P_GL_RED_SIZE: self.glformat.redBufferSize,
            M64P_GL_GREEN_SIZE: self.glformat.greenBufferSize,
            M64P_GL_BLUE_SIZE: self.glformat.blueBufferSize,
            M64P_GL_ALPHA_SIZE: self.glformat.alphaBufferSize,
            M64P_GL_SWAP_CONTROL: self.glformat.swapInterval,
            M64P_GL_MULTISAMPLEBUFFERS: self.glformat.sampleBuffers,
            M64P_GL_MULTISAMPLESAMPLES: self.glformat.samples,
            M64P_GL_CONTEXT_MAJOR_VERSION: self.glformat.majorVersion,
            M64P_GL_CONTEXT_MINOR_VERSION: self.glformat.minorVersion,
            M64P_GL_CONTEXT_PROFILE_MASK: self.glformat.profile
        }
        get_attr = attr_map[attr]
        new_value = int(get_attr())
        if new_value == value.contents.value:
            return M64ERR_SUCCESS
        else:
            return M64ERR_SYSTEM_FAIL

    def gl_swap_buf(self):
        """Swaps the front/back buffers after
        rendering an output video frame. """
        self.widget.swapBuffers()
        return M64ERR_SUCCESS

    def resize_window(self, width, height):
        """Called when the video plugin has resized its OpenGL
        output viewport in response to a ResizeVideoOutput() call"""
        return M64ERR_SUCCESS

    def gl_get_default_framebuffer(self):
        """Gets default framebuffer."""
        return 0

    def set_major(self, major):
        self.major = major

    def set_minor(self, minor):
        self.minor = minor
Пример #13
0
def set_default_context(major_version, minor_version, profile):
    f = QGLFormat()
    f.setVersion(major_version, minor_version)
    f.setProfile(profile)
    QGLFormat.setDefaultFormat(f)
Пример #14
0
def start(mode):
    # Install message handler for Qt messages
    qInstallMessageHandler(gui_msg_handler)

    # Start the Qt main object
    app = QApplication([])

    # Start the bluesky network client
    client = GuiClient()

    # Enable HiDPI support (Qt5 only)
    if QT_VERSION >= 0x050000:
        app.setAttribute(Qt.AA_UseHighDpiPixmaps)

    splash = Splash()

    # Register our custom pan/zoom event
    for etype in range(1000, 1000 + NUMCUSTOMEVENTS):
        reg_etype = QEvent.registerEventType(etype)
        if reg_etype != etype:
            print((
                'Warning: Registered event type differs from requested type id (%d != %d)'
                % (reg_etype, etype)))

    splash.show()

    # Install error message handler
    handler = QErrorMessage.qtHandler()
    handler.setWindowFlags(Qt.WindowStaysOnTopHint)

    # Check and set OpenGL capabilities
    if not QGLFormat.hasOpenGL():
        raise RuntimeError('No OpenGL support detected for this system!')
    else:
        f = QGLFormat()
        f.setVersion(3, 3)
        f.setProfile(QGLFormat.CoreProfile)
        f.setDoubleBuffer(True)
        QGLFormat.setDefaultFormat(f)
        print(('QGLWidget initialized for OpenGL version %d.%d' %
               (f.majorVersion(), f.minorVersion())))

    splash.showMessage('Constructing main window')
    app.processEvents()
    win = MainWindow(mode)
    splash.showMessage('Done!')
    app.processEvents()
    splash.finish(win)

    # Quick hack to connect to a remote simulation
    import sys
    arg = '--bluesky_host='
    host = next((x for x in sys.argv if x.startswith(arg)), None)
    if host is not None:
        host = host[len(arg):]
        try:
            print('Attempting connection to BlueSky at: {}'.format(host))
            client.connect(hostname=host,
                           event_port=bs.settings.event_port,
                           stream_port=bs.settings.stream_port,
                           timeout=5)
        except TimeoutError:
            print('Failed to connect to BlueSky server at {}, exiting'.format(
                host))
            QApplication.quit()
            sys.exit(0)
        win.show()
        app.exec_()
        return

    win.show()

    # If this instance of the gui is started in client-only mode, show
    # server selection dialog
    if mode == 'client':
        dialog = DiscoveryDialog(win)
        dialog.show()
        bs.net.start_discovery()

    else:
        client.connect(event_port=bs.settings.event_port,
                       stream_port=bs.settings.stream_port)

    # Start the Qt main loop
    app.exec_()
Пример #15
0
    def __init__(self, navdb):
        super(Gui, self).__init__([])
        self.acdata          = ACDataEvent()
        self.navdb           = navdb
        self.radarwidget     = []
        self.command_history = []
        self.cmdargs         = []
        self.history_pos     = 0
        self.command_mem     = ''
        self.command_line    = ''
        self.prev_cmdline    = ''
        self.simevent_target = 0
        self.mousedragged    = False
        self.mousepos        = (0, 0)
        self.prevmousepos    = (0, 0)
        self.panzoomchanged  = False
        self.simt            = 0.0

        # Register our custom pan/zoom event
        for etype in [PanZoomEventType, ACDataEventType, SimInfoEventType,
                      StackTextEventType, ShowDialogEventType,
                      DisplayFlagEventType, RouteDataEventType,
                      DisplayShapeEventType, SimQuitEventType,
                      AMANEventType]:
            reg_etype = QEvent.registerEventType(etype)
            if reg_etype != etype:
                print('Warning: Registered event type differs from requested type id (%d != %d)' % (reg_etype, etype))

        self.splash = Splash()
        self.splash.show()

        self.splash.showMessage('Constructing main window')
        self.processEvents()

        # Install error message handler
        handler = QErrorMessage.qtHandler()
        handler.setWindowFlags(Qt.WindowStaysOnTopHint)

        # Check and set OpenGL capabilities
        if not QGLFormat.hasOpenGL():
            raise RuntimeError('No OpenGL support detected for this system!')
        else:
            f = QGLFormat()
            f.setVersion(3, 3)
            f.setProfile(QGLFormat.CoreProfile)
            f.setDoubleBuffer(True)
            QGLFormat.setDefaultFormat(f)
            print('QGLWidget initialized for OpenGL version %d.%d' % (f.majorVersion(), f.minorVersion()))

        # Create the main window and related widgets
        self.radarwidget = RadarWidget(navdb)
        self.win  = MainWindow(self, self.radarwidget)
        self.nd   = ND(shareWidget=self.radarwidget)
        #self.aman = AMANDisplay(shareWidget=self.radarwidget)

        # Enable HiDPI support (Qt5 only)
        if QT_VERSION == 5:
            self.setAttribute(Qt.AA_UseHighDpiPixmaps)

        timer = QTimer(self)
        timer.timeout.connect(self.radarwidget.updateGL)
        timer.timeout.connect(self.nd.updateGL)
        #timer.timeout.connect(self.aman.updateGL)
        timer.start(50)
Пример #16
0
            self.remainder = val - int(val)

        self.update_lcd()
        if self.btn_pressed is not None:
            QTimer.singleShot(200, self.updateAPValues)


if __name__ == "__main__":
    qapp = QApplication([])

    # Check and set OpenGL capabilities
    if not QGLFormat.hasOpenGL():
        raise RuntimeError('No OpenGL support detected for this system!')
    else:
        f = QGLFormat()
        f.setVersion(3, 3)
        f.setProfile(QGLFormat.CoreProfile)
        f.setDoubleBuffer(True)
        QGLFormat.setDefaultFormat(f)
        print('QGLWidget initialized for OpenGL version %d.%d' %
              (f.majorVersion(), f.minorVersion()))

    blip = BlipDriver()
    blip.show()

    gltimer = QTimer(qapp)
    gltimer.timeout.connect(blip.updateGL)
    gltimer.start(50)

    qapp.exec_()
Пример #17
0
    def __init__(self):
        super(DrawingWindow, self).__init__()
        self.history = []
        self.userDefinedPoints = []
        self.setMouseTracking(True)

        #SURFACE setup
        self.ctrPnt = [[
            QVector3D(10, 0, 10),
            QVector3D(5, 0, 10),
            QVector3D(-5, 0, 10),
            QVector3D(-10, 0, 10)
        ],
                       [
                           QVector3D(10, 0, 5),
                           QVector3D(5, 10, 5),
                           QVector3D(-5, 10, 5),
                           QVector3D(-10, 0, 5)
                       ],
                       [
                           QVector3D(10, 0, -5),
                           QVector3D(5, 10, -5),
                           QVector3D(-5, 10, -5),
                           QVector3D(-10, 0, -5)
                       ],
                       [
                           QVector3D(10, 0, -10),
                           QVector3D(5, 0, -10),
                           QVector3D(-5, 0, -10),
                           QVector3D(-10, 0, -10)
                       ]]

        self.vtr = []
        self.vertices = []
        self.indices = []

        self.controlPoints = []
        self.rotationAxis = None

        for row in self.ctrPnt:
            for vector in row:
                self.controlPoints.append(float(vector.x()))
                self.controlPoints.append(float(vector.y()))
                self.controlPoints.append(float(vector.z()))

        self.surface = NURBSSurface(controlNet=self.ctrPnt,
                                    Udegree=3,
                                    Wdegree=3,
                                    Uknots=[0, 0, 0, 0, 1, 1, 1, 1],
                                    Wknots=[0, 0, 0, 0, 1, 1, 1, 1])

        self.surface.setWeights([[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0],
                                 [1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]])
        self.surface.compute()
        self.vtr = self.surface.surfacePoints

        self.indices = triangleRenderer(row=12, col=11)
        normalsList = normalsPerTriangle(self.vtr, self.indices)
        self.surfaceNormals = []
        self.normals = normalsPerVertex(normalsList, len(self.vtr))

        for value in self.vtr:
            self.vertices.append(float(value.x()))
            self.vertices.append(float(value.y()))
            self.vertices.append(float(value.z()))

        for value in self.normals:
            self.surfaceNormals.append(float(value.x()))
            self.surfaceNormals.append(float(value.y()))
            self.surfaceNormals.append(float(value.z()))

        #QTsetting
        glFormat = QGLFormat()
        glFormat.setVersion(3, 2)
        glFormat.setProfile(QGLFormat.CoreProfile)
        QGLFormat.setDefaultFormat(glFormat)
        print(glFormat)

        #camera
        self.camera = Camera(position=QVector3D(0, 7, 20),
                             direction=QVector3D(0, 0, 0),
                             up=QVector3D(0, 1, 0))

        self.normalMatrix = QMatrix4x4()

        #interaction
        self.selectedPoint = None
        self.editFlag = False
        self.showControlPoints = False