Exemple #1
0
//--------------------------------------------------------------
void ofApp::setup()
{
    // Use GL_TEXTURE_2D Textures (normalized texture coordinates 0..1)
    ofDisableArbTex();
  
    m_vignetteShader.load( "shaders/passthrough.vert", "shaders/vignette.frag" );
    m_filmGrainShader.load( "shaders/passthrough.vert", "shaders/filmGrain.frag" );
    m_blurShader.load( "shaders/passthrough.vert", "shaders/boxBlur.frag" );
    m_sobelShader.load( "shaders/passthrough.vert", "shaders/sobel.frag" );

    bool bUseWebcam = false;
    
    if ( true == bUseWebcam )
    {
        m_webcam.initGrabber( 640, 480 );
        m_texture = m_webcam.getTexture();
    }
    else
    {
        ofImage image( "images/image.jpg" );
        m_texture = image.getTexture();
        m_texture.setTextureMinMagFilter( GL_LINEAR, GL_LINEAR );
        m_texture.setTextureWrap( GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE ); // this is important to keep clean edges on the blur
    }
    
    createFullScreenQuad();

    m_blurRadius = 1.0f;
}
//called upon initialising - RT
void PostProcessing::init(int width, int height, string& vertexShaderFilename, string& fragmentShaderFilename)
{
	createFramebuffer(width, height);
	createShader(vertexShaderFilename, fragmentShaderFilename);
	createFullScreenQuad();

}