Пример #1
0
    def initializeGL(self):
        points = self.points
        super().initializeGL('kw4.shaders', lambda _program: POINTS(_program, points))

        eye, target, up = T.vec3(0, 0, 3), T.vec3(0, 0, 0), T.vec3(0, 1, 0)
        self.View = T.lookat(eye, target, up)

        for p in [GL_VERTEX_PROGRAM_POINT_SIZE]:
            glEnable(p)
        self.program.u['pointsize'](800 / self.S)

        # Prepare an application-side SSB region
        self.click_buffer = glGenBuffers(1)
        glBindBuffer(GL_SHADER_STORAGE_BUFFER, self.click_buffer)
        # Bind the 0'th binding point of the SSB to the application-side SSB area
        glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, self.click_buffer)
        # Allocate a storage area on the application
        ssb = SSB()
        # Create and initialize the application-side SSB area
        glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(ssb), pointer(ssb), GL_DYNAMIC_READ)
        glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0)

        for f in 'paint pick'.split():
            self.fragment[f] = glGetSubroutineIndex(self.program._program, GL_FRAGMENT_SHADER, f)
        print(self.fragment)
Пример #2
0
    def initializeGL(self, shaderpath, Geometry):
        eye, target, up = T.vec3(0, 0, 5), T.vec3(0, 0, 0), T.vec3(0, 1, 0)
        self.View = T.lookat(eye, target, up)
        super(D, self).initializeGL(shaderpath, Geometry)

        try:
            self.program.u['worldlight'] = normalize(T.vec3(5, 10, 20))
            print('U[worldlight] = {0}\n'.format(normalize(T.vec3(5, 10, 20))))
        except: pass
Пример #3
0
    def initializeGL(self):
        S = 5
        shaderpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pointgrid.shaders')
        super().initializeGL(shaderpath, lambda program: V(program, S))

        eye, target, up = T.vec3(0, 0, 3), T.vec3(0, 0, 0), T.vec3(0, 1, 0)
        self.View = T.lookat(eye, target, up)
        glEnable(GL_VERTEX_PROGRAM_POINT_SIZE)
        self.program.u['pointsize'](800/S)
Пример #4
0
    def initializeGL(self):
        S = 5
        shaderpath = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                                  'pointgrid.shaders')
        super().initializeGL(shaderpath, lambda program: V(program, S))

        eye, target, up = T.vec3(0, 0, 3), T.vec3(0, 0, 0), T.vec3(0, 1, 0)
        self.View = T.lookat(eye, target, up)
        glEnable(GL_VERTEX_PROGRAM_POINT_SIZE)
        self.program.u['pointsize'](800 / S)
Пример #5
0
    def initializeGL(self):
        S = 5
        vvals = np.array(range(S)) * 2. / (S - 1) - 1.
        points = [ (x, y, 0) for x in vvals for y in vvals ]
        shaderpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pointgrid.shaders')
        super().initializeGL(shaderpath, lambda program: V(program, points))

        eye, target, up = T.vec3(0, 0, 3), T.vec3(0, 0, 0), T.vec3(0, 1, 0)
        self.View = T.lookat(eye, target, up)
        glEnable(GL_VERTEX_PROGRAM_POINT_SIZE)
        self.program.u['pointsize'](800/S)
Пример #6
0
    def initializeGL(self):
        S = 5
        vvals = np.array(range(S)) * 2. / (S - 1) - 1.
        points = [(x, y, 0) for x in vvals for y in vvals]
        shaderpath = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                                  'pointgrid.shaders')
        super().initializeGL(shaderpath, lambda program: V(program, points))

        eye, target, up = T.vec3(0, 0, 3), T.vec3(0, 0, 0), T.vec3(0, 1, 0)
        self.View = T.lookat(eye, target, up)
        glEnable(GL_VERTEX_PROGRAM_POINT_SIZE)
        self.program.u['pointsize'](800 / S)
Пример #7
0
 def paintGL(self):
     eye = T.cartesian(T.rotateY(np.pi /20 * self.time).dot(self.eye))
     self.View = T.lookat(eye, self.target, self.up)
     super().paintGL()
Пример #8
0
 def paintGL(self):
     eye = T.cartesian(T.rotateY(np.pi / 20 * self.time).dot(self.eye))
     self.View = T.lookat(eye, self.target, self.up)
     super().paintGL()