Hello
This is the first version of the GLSLVideoEffects patch. It is made with the Ofelia library.
It creates an effect chain of three GLSL shaders.
The effects are mainly adaptions from existing shaders.
It started as a technical issue, but I think it is a patch on its own now...
I tried to make it easy to change or substitute GLSL effects or to expand the patch.
I have some further ideas, but this is the basic concept.
The interface makes also use of the new "coords" message for canvas positions, which works very well.
-
Ofelia GLSL Video Effects
-
Hi @Jona! I would like to try your patch, but it does not show me any video. Maybe i miss fundamental things i should do? I open a file but still nothing. I have no experience with ofelia, but the video example works with the same video. Console gives me this:
ofelia: [string "package.preload['1003-video1'] = nil package...."]:4: attempt to call a nil value (global 'ofWindow')
ofelia: [string "package.preload['1003-video1'] = nil package...."]:4: attempt to call a nil value (global 'ofWindow')
ofelia: [string "package.preload['1003-video1'] = nil package...."]:4: attempt to call a nil value (global 'ofWindow')
ofelia: [string "package.preload['1003-video1'] = nil package...."]:4: attempt to call a nil value (global 'ofWindow')anybody understands what i'm doing wrong?
EDIT: somehow it is not opening the playback window.
-
Hi @Johnny-Mauser.
If it does not find ofWindow it can not open the playback window.
I would try to install the newest Ofelia version from Deken,
There were some changes (like pdSysGui) so that newer patches can not run on older versions anymore (depending on what is used).
Perhaps also install the newest PD version because of the coords message? -
Thx for the fast reply! Will try that when back at the computer and edit this reply.
EDIT: Jarrrr it works with the newest ofelia from deken!! very cool!!! Thank you! but most of the shaders are not working. No problem for me, as i was just testing. If I have time, i will look into this further. I use OSX 10.11.6.
Effects that work: Angle, Bokeh, FractTexture.
To make it work here it looks like i would have to tweek the shader code. Maybe there is some OS dependend stuff?
Console gives (e.g. for AsciiArt):ofShader: setupShaderFromSource(): GL_FRAGMENT_SHADER shader failed to compile
: ofShader: GL_FRAGMENT_SHADER shader reports:
ERROR: 0:1: '<' : syntax error: syntax error: ofShader: GL_FRAGMENT_SHADER, offending line 1 :
1 //fragment program
2
3 uniform sampler2D Tex0;ofShader: checkProgramLinkStatus(): program failed to link
ofShader: ofShader: program reports:
ERROR: One or more attached shaders not successfully compiled -
@Johnny-Mauser nice that it works. but strange that some effects do not work, i thought they are os independent.
but line one is just a comment (everything with // in the beginning). you can just delete it perhaps. -
I updated the patch for Ofelia v3: GLSL_Video_Effects_V01_Ofelia3.zip
@cuinjune somehow the patch only works with Ofelia 3 if I call the module variable M with a name different than M (in my case "m").
this works:local m = require("$0-video1");
and this does not work:
local M = require("$0-video1");
I do not understand the behaviour yet because in the variable example I can still use
local M = require("$0-abc");
without any problem...
Another relating question: Is ofelia and M still the same?
-
@Jona Yes,
M
is just an alias forofelia
module table.The actual full script that runs in Lua when you create [ofelia define foo] object is like the following:
local name = "foo" package.preload[name] = nil package.loaded[name] = nil package.preload[name] = function(this) local ofelia = {} local M = ofelia -- Your written script will be here. return M end
And sending the 'bang' message to this object will run the following script:
local m = require("foo") if type(m.bang) == "function" then return m:bang() -- the object will output the returned value through its outlet end
I added
M
since it's easier to write and the script can be shorter. Also,M
is commonly used in Lua as a variable name for a module table.Therefore, you should not reassign anything to
M
orofelia
in almost any case since it can be problematic.