View Full Version : shader file naming convention
Is there a GLSL shader file naming convention?
I have seen some examples that use .vert and .frag, while others use _vertex.glsl and _fragment.glsl.
Is there an existing or emerging naming convention?
On a related note, is there a way to get Developer Studio to recognize GLSL files like it does .cpp and other common file types? I would like to get the key word and comment color coding. I have seen this with D3D shader files, so I suspect there is way to get it to work for GLSL but I don't know the magic DevStudio incantation.
12-03-2004, 08:18 AM
Humus had a very handy couple of files which you could add to your registry & usertype.dat and which adds syntax colouring for all the ARBvp, ARBfp and GLSL keywords. I just had a quick look at his site (http://www.humus.ca) though and I can't seem to find it anywhere, but he hangs around here so I'm sure he'll point you in the right direction soon enough.
As for naming conventions, I tend to use .vert and .frag, but I don't think there's any widespread convention. I'd be interested to hear what other people use though.
12-03-2004, 09:29 AM
Personally, I like .vert and .frag convention ^^
i use *.glsl (one file per shader)
syntax highlighting from jwatte
Thanks for the info.
I was able to get the color coding working on key words within Developer Studio. I don't quite have the ideal solution, but it definitely helps. I use the .cpp color coding and then a special color for "User Keywords" that include the GLSL key words.
Regarding the file naming convention - using .glsl seems to make sense if you organize your code by object type, since you can put the vertex and fragment routines in one file.
If, however, you organize your code for reusability across multiple object types, then the .vert and .frag approach might make sense. I want to share common code for lighting and fog across many different object types, so I think I will shift to the .vert/.frag approach. It keeps the file names shorter and a little easier to read.
12-06-2004, 09:40 PM
If you have Visual Assist for Visual Studio you can use this header file http://home.ripway.com/2004-11/198558/glsl.zip to get syntax coloring/parameter info/etc. No need to include it - just open it in editor, so VA can parse it.
And you need to add your glsl file extensions (.glsl or .vert & .frag) to VA extensions ( http://wholetomato.com/support/faq.html#extension )
12-07-2004, 06:24 AM
I have been using .vp (arb_vp vertex program), .fp (arb_fp fragment program), .vs (glsl vertex shader), and .fs (glsl fragment shader). A good convention would be nice, though.
12-11-2004, 02:01 PM
If anyone is interested, vim syntax files for GLSL can be found here:
Does anyone know if a syntax highlighting file has been written for emacs?
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.