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
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()
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)
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)
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);
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)
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)
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
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()
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()