Thursday, May 1, 2014

Qt loading shaders from resource files (call qmake after creating the resource file)

I was recently playing with Qt and its support of shaders. Qt provides a bunch of useful classes for shader handling. So I thought of making my hands dirty. The first thing I did was try to load my simple triangle demo using shaders. I started out with using the QGLShaderProgram class with loading shaders as resource. I kept getting errors saying that the shader files cannot be loaded from the specified path. So then I realized I had to create a Qt resource file and manually add my shaders into the resource file. 

After doing all this, once again when I tried to run the demo, it still told me that the shader did not exist on the specified path. After many tries I came to know the reason for why the path could not be found. Once the resource file is created and the shader files are added to the resource file, we need to call qmake on the project. Without calling it, I kept getting the file not found error. I could not find any information on this so I thought I would include it here on my blog for others who fall into the same trap.


Popular Posts

Copyright (C) 2011 - Movania Muhammad Mobeen. Awesome Inc. theme. Powered by Blogger.