parameters: (self)
docstring: Iterate and allocate 1/2/3D textures needed by the current
          OCIO GPU processor. 3D LUTs become 3D textures and 1D LUTs
          become 1D or 2D textures depending on their size. Since
          textures have a hardware enforced width limitation, large LUTs
          are wrapped onto multiple rows.
  
          .. note::
              Each time this runs, the previous set of textures are
              deleted from GPU memory first.
docstring_summary: Iterate and allocate 1/2/3D textures needed by the current
          OCIO GPU processor. 3D LUTs become 3D textures and 1D LUTs
          become 1D or 2D textures depending on their size. Since
          textures have a hardware enforced width limitation, large LUTs
          are wrapped onto multiple rows.
docstring_tokens: Iterate and allocate 1 / 2 / 3D textures needed by the current OCIO GPU processor . 3D LUTs become 3D textures and 1D LUTs become 1D or 2D textures depending on their size . Since textures have a hardware enforced width limitation large LUTs are wrapped onto multiple rows .
function: def _allocate_ocio_tex(self):
          """
          Iterate and allocate 1/2/3D textures needed by the current
          OCIO GPU processor. 3D LUTs become 3D textures and 1D LUTs
          become 1D or 2D textures depending on their size. Since
          textures have a hardware enforced width limitation, large LUTs
          are wrapped onto multiple rows.
  
          .. note::
              Each time this runs, the previous set of textures are
              deleted from GPU memory first.
          """
          if not self._ocio_shader_desc:
              return
  
          self.makeCurrent()
  
          # Delete previous textures
          self._del_ocio_tex()
          self._del_ocio_uniforms()
  
          tex_index = self._ocio_tex_start_index
  
          # Process 3D textures
          for tex_info in self._ocio_shader_desc.get3DTextures():
              tex_data = tex_info.getValues()
  
              tex = GL.glGenTextures(1)
              GL.glActiveTexture(GL.GL_TEXTURE0 + tex_index)
              GL.glBindTexture(GL.GL_TEXTURE_3D, tex)
              self._set_ocio_tex_params(GL.GL_TEXTURE_3D, tex_info.interpolation)
              GL.glTexImage3D(
                  GL.GL_TEXTURE_3D,
                  0,
                  GL.GL_RGB32F,
                  tex_info.edgeLen,
                  tex_info.edgeLen,
                  tex_info.edgeLen,
                  0,
                  GL.GL_RGB,
                  GL.GL_FLOAT,
                  tex_data
              )
  
              self._ocio_tex_ids.append((
                  tex,
                  tex_info.textureName,
                  tex_info.samplerName,
                  GL.GL_TEXTURE_3D,
                  tex_index
              ))
              tex_index += 1
  
          # Process 2D textures
          for tex_info in self._ocio_shader_desc.getTextures():
              tex_data = tex_info.getValues()
  
              internal_fmt = GL.GL_RGB32F
              fmt = GL.GL_RGB
              if tex_info.channel == self._ocio_shader_desc.TEXTURE_RED_CHANNEL:
                  internal_fmt = GL.GL_R32F
                  fmt = GL.GL_RED
  
              tex = GL.glGenTextures(1)
              GL.glActiveTexture(GL.GL_TEXTURE0 + tex_index)
  
              if tex_info.height > 1:
                  tex_type = GL.GL_TEXTURE_2D
                  GL.glBindTexture(tex_type, tex)
                  self._set_ocio_tex_params(tex_type, tex_info.interpolation)
                  GL.glTexImage2D(
                      tex_type,
                      0,
                      internal_fmt,
                      tex_info.width,
                      tex_info.height,
                      0,
                      fmt,
                      GL.GL_FLOAT,
                      tex_data
                  )
              else:
                  tex_type = GL.GL_TEXTURE_1D
                  GL.glBindTexture(tex_type, tex)
                  self._set_ocio_tex_params(tex_type, tex_info.interpolation)
                  GL.glTexImage1D(
                      tex_type,
                      0,
                      internal_fmt,
                      tex_info.width,
                      0,
                      fmt,
                      GL.GL_FLOAT,
                      tex_data
                  )
  
              self._ocio_tex_ids.append((
                  tex,
                  tex_info.textureName,
                  tex_info.samplerName,
                  tex_type,
                  tex_index
              ))
              tex_index += 1
function_tokens: def _allocate_ocio_tex ( self ) : if not self . _ocio_shader_desc : return self . makeCurrent ( ) # Delete previous textures self . _del_ocio_tex ( ) self . _del_ocio_uniforms ( ) tex_index = self . _ocio_tex_start_index # Process 3D textures for tex_info in self . _ocio_shader_desc . get3DTextures ( ) : tex_data = tex_info . getValues ( ) tex = GL . glGenTextures ( 1 ) GL . glActiveTexture ( GL . GL_TEXTURE0 + tex_index ) GL . glBindTexture ( GL . GL_TEXTURE_3D , tex ) self . _set_ocio_tex_params ( GL . GL_TEXTURE_3D , tex_info . interpolation ) GL . glTexImage3D ( GL . GL_TEXTURE_3D , 0 , GL . GL_RGB32F , tex_info . edgeLen , tex_info . edgeLen , tex_info . edgeLen , 0 , GL . GL_RGB , GL . GL_FLOAT , tex_data ) self . _ocio_tex_ids . append ( ( tex , tex_info . textureName , tex_info . samplerName , GL . GL_TEXTURE_3D , tex_index ) ) tex_index += 1 # Process 2D textures for tex_info in self . _ocio_shader_desc . getTextures ( ) : tex_data = tex_info . getValues ( ) internal_fmt = GL . GL_RGB32F fmt = GL . GL_RGB if tex_info . channel == self . _ocio_shader_desc . TEXTURE_RED_CHANNEL : internal_fmt = GL . GL_R32F fmt = GL . GL_RED tex = GL . glGenTextures ( 1 ) GL . glActiveTexture ( GL . GL_TEXTURE0 + tex_index ) if tex_info . height > 1 : tex_type = GL . GL_TEXTURE_2D GL . glBindTexture ( tex_type , tex ) self . _set_ocio_tex_params ( tex_type , tex_info . interpolation ) GL . glTexImage2D ( tex_type , 0 , internal_fmt , tex_info . width , tex_info . height , 0 , fmt , GL . GL_FLOAT , tex_data ) else : tex_type = GL . GL_TEXTURE_1D GL . glBindTexture ( tex_type , tex ) self . _set_ocio_tex_params ( tex_type , tex_info . interpolation ) GL . glTexImage1D ( tex_type , 0 , internal_fmt , tex_info . width , 0 , fmt , GL . GL_FLOAT , tex_data ) self . _ocio_tex_ids . append ( ( tex , tex_info . textureName , tex_info . samplerName , tex_type , tex_index ) ) tex_index += 1