GLSL runs really slow! #2

shaohuawan opened this Issue Jan 9, 2012 · 7 comments


None yet

2 participants



The FaceSubstitution/FaceSubstitution example code runs extremely slow on my machine, with a frame rate of less than 1fps.
And the FaceSubstitution/CloningWrapper example code runs also extremely slow on my machine, with a frame rate of less than 1fps.

I have found that when the two two calls to maskedBlur(src, mask, srcBlur) are commented out from FaceSubstitution/CloningWrapper/src/Cloning.cpp, my program would speed up.

Therefore, maskedBlur(ofTexture& tex, ofTexture& mask, ofFbo& result) in FaceSubstitution/CloningWrapper/src/Cloning.cpp is the function that is slowing everything down.

But I don't know why it would slow down my program. And I don't know how to solve this problem.

Do you have any idea of what is happening?

Shaohua Wan


maskedBlur is necessarily a resource-intensive operation. on modern machines it should not be a problem, but on older machines, or machines where the GLSL it is emulated in software, you will have a problem.

i recommend trying the CPUCloning example instead, and then rewriting the CloningWrapper to use the CPU.


Thanks for your reply.
My machine is a 3.8GHz machine with a 8Gb RAM. And it has a Intel Core i7 Processor. It is a really powerful machine. I don't know why the program runs so slow on it.
Anyway, how to determine GLSL is emulated in software?

In addition, the CPUCloning example runs very fast.


if you have a computer that has a switchable graphics card, it could be using the slower of the two.

or if the GLSL shader is using a feature that is not supported by the graphics card, then it could be falling back to emulation mode.

normally on OSX i use the opengl shader builder to let me know whether it's running in software mode or not. if you're on linux or windows, i'm not sure which tool to use.

maybe this line is confusing your graphics card:

#extension GL_ARB_texture_rectangle : enable

you could try removing that.

sorry i can't be more help!


Thanks anyway. I will try. :)


Problem solved!
After I install a new driver for my graphic card, my program now runs perfectly smooth. Thanks!
My graphic card is GeForce GT 530. The old driver version number was After I install a new driver for my machine, now it works flawlessly.


hey great to hear! maybe post a link to the new graphics card driver, in case someone else has the same problem? then they can find the answer faster.


If you are using Ubuntu 11.10, then by default the proprietary graphics driver are not loaded. You have to load it manually in order for the graphic card to work properly. Here is how to do it.
1. Choose "Additional Drivers" from "System Settings";
2. Choose "NVIDIA accelerated graphics driver(post-release updates)(version current-updates)" from "Additional Drivers";
3. Click "Activate"
Then we are done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment