3

I've just discovered the OpenGL Shader Builder in Apple's developer tools. It seems mighty useful. Only trouble is that it seems to insist on using *.vs and *.fs in the save dialogue, where as I normally use *.vert and *.frag respectively for my shader file extensions. Is there any way to change these defaults? (this could involve a hacky solution)

Kara
  • 5,650
  • 15
  • 48
  • 55
bjz
  • 941
  • 1
  • 8
  • 26

1 Answers1

2

I first ended up using my custom #include preprocessor (very simple to make!)

Made dummy wrapper shader :

test.vert

#include test.vs

test.frag

#include test.fs

It's a semi-terrible hack and is definitely something you don't want to include in svn/git/whatever if you are sharing the code, but great when you need the turnaround when tweaking.

As more people ended up using several different file extensions I ended up adding more ways to load shaders.

LoadShader("MyShader", <List of preprocessors>)
LoadShader("vertex shader", "fragment shader", ... , <List of preprocessors>)

(Simplified here. What is really passed in is a structure)

The first function would do the following :

  • Text files with [".vert",".vs".. etc] for the vertex shader
  • Text files with [".frag",".fs".. etc] for the fragment shader
  • etc..

The user can define what file extensions they want to support.

The second function is just using exact file names. In the first function the possible combinations are limited by preprocessors. In the second option you can combine any shader file you want and also make variations with preprocessors.

This is of course simplified, but shows the general idea.

Grimmy
  • 3,280
  • 19
  • 23