This post continues, in some way, a post written by Tim Janick on his blog, about OpenGL for Gdk/Gtk+, that summarizes some of problems about using OpenGL with Gdk/Gtk+.
MDK made some tests to compare one an another, I had a little curiosity and check the code. The shader version was written in Cg, and as there are a lot of time that I doesn’t write nothing related to shaders, I decided to waste the little free time I have making the GLSL version of this test this afternoon.
I same the sames tests, except by environment:
- AMD 1800+ 784MB RAM
- Geforce 5900FX 128 MB RAM
- modified source code (you’ll dont require Cg Toolkit, instead you’ll require Glew)
And the visual results:
But the most curious was about the times (sorry, not chart this time);
- cairo: 0,18494 s
- cg: 0.01927 s
- GLSL: 0.00155 s
GLSL better than cg? I suppose that this is the easy answer but:
- First at all: its too much difference, it has no sense
- AFAIK GLSL driver compiler its almost the Cg compiler (they use a Unified Arquitecture), you only need to see the extension EXT_Cg_Shader (use Cg code to define a shader object)
- OpenGL works asynchronously
- The profile: Cg implementation uses a concrete profile (CG_PROFILE_ARBVP1), GLSL hasn’t got this concept, it tries allways to search the bext vertex/fragment program extension to use.
- So: the time of only draw some curves its not a accurate (we knowed it before) measure, it is only a guide
Conclusion: it is good to revive some time GLSL, I need to do this more often, thanks to MDK to give us some code to play !