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)
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 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 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: PointGrid(program, 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] 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: PointGrid(program, 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)