Beispiel #1
0
GPUBlurFilter::GPUBlurFilter(const IntPoint& size, PixelFormat pfSrc, PixelFormat pfDest,
        float stdDev, bool bClipBorders, bool bStandalone, bool bUseFloatKernel)
    : GPUFilter(pfSrc, pfDest, bStandalone, SHADERID_HORIZ, 2),
      m_bClipBorders(bClipBorders),
      m_bUseFloatKernel(bUseFloatKernel)
{
    ObjectCounter::get()->incRef(&typeid(*this));

    GLContext::getCurrent()->ensureFullShaders("GPUBlurFilter");
#ifndef AVG_ENABLE_EGL
    if (!m_bClipBorders) {
        //TODO: TO_BORDER DOES NOT EXIST IN GLESV2
        m_WrapMode = WrapMode(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_BORDER);
    }
#endif
    setDimensions(size, stdDev);
    GLContextManager* pCM = GLContextManager::get();
    pCM->createShader(SHADERID_VERT);
    setStdDev(stdDev);

    m_pHorizWidthParam = pCM->createShaderParam<float>(SHADERID_HORIZ, "u_Width");
    m_pHorizRadiusParam = pCM->createShaderParam<int>(SHADERID_HORIZ, "u_Radius");
    m_pHorizTextureParam = pCM->createShaderParam<int>(SHADERID_HORIZ, "u_Texture");
    m_pHorizKernelTexParam = pCM->createShaderParam<int>(SHADERID_HORIZ, "u_KernelTex");

    m_pVertWidthParam = pCM->createShaderParam<float>(SHADERID_VERT, "u_Width");
    m_pVertRadiusParam = pCM->createShaderParam<int>(SHADERID_VERT, "u_Radius");
    m_pVertTextureParam = pCM->createShaderParam<int>(SHADERID_VERT, "u_Texture");
    m_pVertKernelTexParam = pCM->createShaderParam<int>(SHADERID_VERT, "u_KernelTex");
}
GPUBlurFilter::GPUBlurFilter(const IntPoint& size, PixelFormat pfSrc, PixelFormat pfDest,
        float stdDev, bool bClipBorders, bool bStandalone, bool bUseFloatKernel)
    : GPUFilter(pfSrc, pfDest, bStandalone, SHADERID_HORIZ, 2),
      m_bClipBorders(bClipBorders),
      m_bUseFloatKernel(bUseFloatKernel)
{
    ObjectCounter::get()->incRef(&typeid(*this));

    setDimensions(size, stdDev, bClipBorders);
    createShader(SHADERID_VERT);
    setStdDev(stdDev);

    OGLShaderPtr pShader = getShader();
    m_pHorizWidthParam = pShader->getParam<float>("u_Width");
    m_pHorizRadiusParam = pShader->getParam<int>("u_Radius");
    m_pHorizTextureParam = pShader->getParam<int>("u_Texture");
    m_pHorizKernelTexParam = pShader->getParam<int>("u_KernelTex");

    pShader = avg::getShader(SHADERID_VERT);
    m_pVertWidthParam = pShader->getParam<float>("u_Width");
    m_pVertRadiusParam = pShader->getParam<int>("u_Radius");
    m_pVertTextureParam = pShader->getParam<int>("u_Texture");
    m_pVertKernelTexParam = pShader->getParam<int>("u_KernelTex");
}