Esempio n. 1
0
 def __init__(self, widget):
     super().__init__(widget)
     self.eye = T.homogeneous(T.vec3(0.2, 1.1, 1.2))
     self.target = T.vec3(0.5, 0.6, 0.7)
     self.up = T.vec3(0, 1, 0)
     self.paint = None
     self.doPaint = -1
Esempio n. 2
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)
     dp = math.floor(self.time / 5) % 2
     if self.doPaint != dp:
         self.doPaint = dp
         glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, 1, [self.doPaint])
     super().paintGL()
Esempio n. 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)
Esempio n. 4
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)
Esempio n. 5
0
    def initializeGL(self):

        S = 100
        super().initializeGL('kw1.shaders', lambda program: Points(program, self.points(S)))

        self.eye = T.homogeneous(T.vec3(0.2, 1.1, 1.2))
        self.target, self.up = T.vec3(0.5, 0.6, 0.7), T.vec3(0, 1, 0)

        for p in [ GL_VERTEX_PROGRAM_POINT_SIZE, GL_CLIP_PLANE0, GL_BLEND ]:
            glEnable(p)
        self.program.u['pointsize'](800/S)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Esempio n. 6
0
File: kw1a.py Progetto: wakita/glvis
    def initializeGL(self):

        S = 100
        super().initializeGL('kw1.shaders',
                             lambda program: Points(program, self.points(S)))

        self.eye = T.homogeneous(T.vec3(0.2, 1.1, 1.2))
        self.target, self.up = T.vec3(0.5, 0.6, 0.7), T.vec3(0, 1, 0)

        for p in [GL_VERTEX_PROGRAM_POINT_SIZE, GL_CLIP_PLANE0, GL_BLEND]:
            glEnable(p)
        self.program.u['pointsize'](800 / S)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
Esempio n. 7
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]
        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, GL_CLIP_PLANE0, GL_BLEND]:
            glEnable(p)
        self.program.u['pointsize'](800 / S)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

        ssbo = glGenBuffers(1)
        glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo)
        ssb = SSB(pick_z=1000, pick_oid=-1)
        glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(ssb), pointer(ssb),
                     GL_DYNAMIC_READ)
        glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, ssbo)
Esempio n. 8
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
Esempio n. 9
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()
Esempio n. 10
0
File: kw1a.py Progetto: wakita/glvis
 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()