Author Topic: Linking GLSL shaders in projects  (Read 5418 times)

Offline macusual

  • Single posting newcomer
  • *
  • Posts: 2
Linking GLSL shaders in projects
« on: July 23, 2014, 11:26:28 pm »
Hello all,

I'm interested in using openFrameworks together with Code::Blocks to create graphics programs. For this I will need to frequently use shaders with the .vert or .frag extensions. My question is how do I best create these files and link them to the project inside Code::Blocks? Do I create an empty file and create 'shader.frag' in the main folder? Whenever I try this and try to link it in the main .cpp file, it can't find it. It can only find it inside the bin/data folder path. Is this the only way to do it? Seems a little clumsy.

Any help would be appreciated.

Thanks!

Offline koonschi

  • Multiple posting newcomer
  • *
  • Posts: 27
    • My personal project
Re: Linking GLSL shaders in projects
« Reply #1 on: July 28, 2014, 01:24:41 pm »
First of all, what compiler are you using? I don't know very much about compiling and linking resources with gcc.

For all I know, usually you have .vert and .frag files and they are distributed with your program and loaded during runtime. You don't actually link them, what you do is you provide the path in your program where to find the files and they are loading during runtime.

You can add the files to the project though, they won't be compiled nor linked, but you can edit them from within codeblocks then.

Edit: IF you're using gcc, you might want to take a look at this post: http://stackoverflow.com/questions/4158900/embedding-resources-in-executable-using-gcc
« Last Edit: July 28, 2014, 01:28:52 pm by koonschi »
"As a general rule, the compiler is smarter than you, and working in your best interest. Do not question it." - Terry Mahaffey

#define TRUE FALSE // happy debugging suckers