[osg-users] Reading shader source on Mac
filip.wanstrom at tii.se
Mon Sep 8 01:07:47 PDT 2008
More merry mac musings...
I get the impression (from the osg source) that when a shader is read from
the file it uses raw c++ IO. This means that shaders source that I have put
in my Resources directory in my App bundle (e.g.
OsgTest.app/Contents/Resources/data/shaders/simple.vert) won't read.
I remedied this by using the following snippet of mac code:
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path,
// In use:
v->loadShaderSourceFromFile( "data/shaders/simple.vert" );
f->loadShaderSourceFromFile( "data/shaders/simple.frag" );
Obviously something like that happens in the image and model loading code so
I guess it's easy to fix If you have access (and understanding of!) to the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the osg-users