Пример #1
0
        Initialises all textures 
        '''
        BUFFER_LEVEL = self._bufferLevel
        BUFFER_RESOLUTION = self._length
        self._levels = list()
        
        # Creates a new textures group 
        tex = (c_uint * (BUFFER_LEVEL + 1))(0)
        glGenTextures(BUFFER_LEVEL + 1, tex)
        tex[0] = self._inputID
        
        # Make lower-resolution texture images
        for i in range(0,BUFFER_LEVEL+1):
            # Set up level object
            size = int(BUFFER_RESOLUTION / math.pow(2,i))
            # (Note: Don't reduce the last, 1x1 texture...)
            if i < BUFFER_LEVEL:
                self._levels.append(ReductionLevel(tex[i],size,tex[i+1],self._quadList))
            if i > 0:
                # Set up texture
                glBindTexture(GL_TEXTURE_2D, tex[i])
                # Set texture parameters
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)  
                # Define texture with floating point format
                glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA32F,size, size,0,GL_RGBA,GL_FLOAT,0)

if __name__=="__main__":
    import Visualisation
    Visualisation.GadgetTest()