I’m trying to modify an existing example so that I can apply a shader to a recorded video clip. The problem I’m running into is that the camera is capturing at 1280 x 720, but the quad I’m trying to map that texture to is 640 x 480. I can access the texture in my shader, but it’s cropping the texture and not scaling it like I want. Any help is appreciated.
Source code is here: https://github.com/thelastbaldwin/of/blob/master/apps/myApps/OC_video/src/ofApp.cpp
For scaling down image i use
int w = myImage.width / 2; int h = myImage.height / 2; myImage.resize( w, h ); myImage.allocate( w, h, OF_IMAGE_COLOR_ALPHA); fbo.allocate( w, h );
Hope this will help .
Thanks. I would up hacking my way out in the shader with something like the following:
vec2 pos = gl_FragCoord.xy * vec2(textureWidth/fboWidth, textureHeight/fboHeight);
I then just looked up the texture using that pos variable. I’m not super happy with this solution, but I do see what you mean about simply resizing the texture. My texture is not a power of 2 and I may not have mapped the texture coordinates correctly.