void
   PottsLabeling3_Relaxed::allocate(int w, int h)
   {
      _width = w;
      _height = h;

      _uBufA->allocate(w, h);
      _uBufB->allocate(w, h);

#if defined(GPU_POTTS_LABELING_USE_PACKED_P)
      _pBufA->allocate(w, h);
      _pBufB->allocate(w, h);
#else
      _p1TexA.allocateID();
      _p1TexA.reserve(w, h, TextureSpecification("rgb=16f"));
      _p2TexA.allocateID();
      _p2TexA.reserve(w, h, TextureSpecification("rgb=16f"));
      _p1TexB.allocateID();
      _p1TexB.reserve(w, h, TextureSpecification("rgb=16f"));
      _p2TexB.allocateID();
      _p2TexB.reserve(w, h, TextureSpecification("rgb=16f"));

      _pFboA->allocate();
      _pFboA->makeCurrent();
      _pFboA->attachTexture2D(_p1TexA, GL_COLOR_ATTACHMENT0_EXT);
      _pFboA->attachTexture2D(_p2TexA, GL_COLOR_ATTACHMENT1_EXT);

      _pFboB->allocate();
      _pFboB->makeCurrent();
      _pFboB->attachTexture2D(_p1TexB, GL_COLOR_ATTACHMENT0_EXT);
      _pFboB->attachTexture2D(_p2TexB, GL_COLOR_ATTACHMENT1_EXT);
#endif
   } // end PottsLabeling3_Relaxed::allocate()
示例#2
0
   void
   ParametricUndistortionFilter::allocate(int w, int h)
   {
      _width = w;
      _height = h;

      _srcTex.allocateID();
      _srcTex.reserve(w, h, TextureSpecification("rgb=8"));
      _srcTex.bind(GL_TEXTURE0);
      glTexParameteri(_srcTex.textureTarget(), GL_TEXTURE_MIN_FILTER, GL_LINEAR);
      glTexParameteri(_srcTex.textureTarget(), GL_TEXTURE_MAG_FILTER, GL_LINEAR);

      _destBuffer.allocate(w, h);

      if (parametricShader == 0)
      {
         parametricShader = new Cg_FragmentProgram("ParametricUndistortionFilter::parametricShader");
         parametricShader->setProgramFromFile("undistort_parametric.cg");
#if 0
         char const * cgArgs[] = { "-bestprecision", "-nofastmath", "-nofastprecision", 0 };
         parametricShader->compile(cgArgs);
#else
         parametricShader->compile();
#endif
         checkGLErrorsHere0();
      }
   }
   void
   PottsLabeling4_LevelFun::allocate(int w, int h)
   {
      _width = w;
      _height = h;

      _uBufA->allocate(w, h);
      _uBufB->allocate(w, h);

      _p1TexA.allocateID();
      _p1TexA.reserve(w, h, TextureSpecification("rgba=16f"));
      _p2TexA.allocateID();
      _p2TexA.reserve(w, h, TextureSpecification("rgba=16f"));
      _p1TexB.allocateID();
      _p1TexB.reserve(w, h, TextureSpecification("rgba=16f"));
      _p2TexB.allocateID();
      _p2TexB.reserve(w, h, TextureSpecification("rgba=16f"));

      _qTexA.allocateID();
      _qTexA.reserve(w, h, TextureSpecification("rgba=16f"));
      _qTexB.allocateID();
      _qTexB.reserve(w, h, TextureSpecification("rgba=16f"));

      _pFboA->allocate();
      _pFboA->makeCurrent();
      _pFboA->attachTexture2D(_p1TexA, GL_COLOR_ATTACHMENT0_EXT);
      _pFboA->attachTexture2D(_p2TexA, GL_COLOR_ATTACHMENT1_EXT);
      _pFboA->attachTexture2D(_qTexA, GL_COLOR_ATTACHMENT2_EXT);

      _pFboB->allocate();
      _pFboB->makeCurrent();
      _pFboB->attachTexture2D(_p1TexB, GL_COLOR_ATTACHMENT0_EXT);
      _pFboB->attachTexture2D(_p2TexB, GL_COLOR_ATTACHMENT1_EXT);
      _pFboB->attachTexture2D(_qTexB, GL_COLOR_ATTACHMENT2_EXT);
   } // end PottsLabeling4_LevelFun::allocate()