I’m currently working on a project that takes in n number of videos, slices them up into squares and draws them at somewhat random positions on the screen.
Basic movie loading, getting texture(s) from each movie and drawing using
qtime::MovieGlRef movie = qtime::MovieGl::create (path);
movieTexture = movie->getTexture();
gl::draw (movieTexture, src, dest);
Everything is looking and performing somewhat as expected, playing 10 videos at once is taking about 28-30% CPU on my Macbook Pro (2.3 GHz i7 w/ a GeForce GT 750M) (4 year old Macbook) on a debug build.
I’m at a point now where I’d like to add a shader and apply it to the texture(s) that are being drawn… Just trying to understand how cinder::gl/OpenGL work. My OpenGL plumbing chops are a bit rusty (currently reading lots of bits and pieces online and digging into “the” OpenGL book).
So my question is:
- Can a shader be applied to a texture after it is drawn using
- I’m currently looking at
gl::draw (const Texture2dRef &texture, const Area &srcArea, const Rectf &dstRect)implementation and from what I understand if I wanted to add a shader to a texture I would basically need to roll my own version of
gl::drawTexturewhich would have my custom shader in addition to what the original IMPL is doing.
Also where is this https://github.com/cinder/Cinder/blob/bcff0b9df2aff499971a08f707f52d787747f8d9/src/cinder/gl/draw.cpp#L300 “stock” shader located? Is it baked in to the library binary as text or is it generated on the fly? Going to dig a little more for it.
I obviously have lot more to take in and wrap my head around to understand how things actually get bound/drawn etc. so any help would be appreciated.