Convolution shader on image


#1

Hi,
i’m newbie of OF.
I would like to write a shader for applying a motion blur and high contrast to a still image but I can’t find a tutorial or a working base program to start with.

can you help me please?

thank you


#2

Hi kronikle,

OF comes with an example folder, which is often the best place to start. In the example folder you find a folder shader, holding 9 examples for different shaders.

hope this helps, have a great day!
oe


#3

thank you I found the examples and everything went well.
Anyway I found that the program loads the GL2 version of shaders even if I have a GTX1070 and OpenGL 4.4 v installed.
why?


#4

in the example, like 01_simpleColorQuad, in the ofApp.cpp there is a chunk of code like:

#ifdef TARGET_OPENGLES
        shader.load("shadersES2/shader");
#else
        if(ofIsGLProgrammableRenderer()){
                shader.load("shadersGL3/shader");
        }else{
                shader.load("shadersGL2/shader");
        }
#endif
}

This is the part of code responsible for the loaded shaders. Try to figure out in which branch condition are you ending up.


#5

no matter what hardware you have OF defaults to opengl 2.1 by now. If you want to use opengl 3 or later you need to explicitly specify it in main.cpp like:


#include "ofMain.h"
#include "ofApp.h"

//========================================================================
int main(){
	  ofGLFWWindowSettings settings;
	  settings.setGLVersion(3,3);
	  ofCreateWindow(settings);
	  ofRunApp(new ofApp);
}

#6

Perfect! thank you!