PDA

View Full Version : file extensions



jide
11-23-2005, 11:10 AM
I had begun some syntax highliting support for vi (vim, and gvim), but those editors mainly need extensions to detect which syntax it will use. It could be supported in vi 7. I guess it can support it in other ways but I didn't find out the solution at this moment.

I personally use *.vsh and *.fsh respectively for vertex shader files and fragment shader files.

In a first part, I'd like to know what extensions do you personally use, and also if that can interrest some of you. Notes: vi is mainly a Unix text editor but I know that gvim is supported under Windows too.

Also, I'd like to say that the syntax actually supports almost all things, but I may do a differentiation between vertex and fragment sources (as, and if I'm not wrong, there can have some differences between what can be used depending on the vertex/fragement source).

skvinay
11-23-2005, 11:27 AM
Is it also possible to support it being written as a string?

One could write a program in a separate file and thus syntax highlight the code like you are doing (which is great!)

But if I want to write say a cpp file with the program as a string, is it possible to come up with a syntax highlighter for it ? (combining a very basic c++ syntax and glsl in a string)

Just a random thought.

Extrawurst
11-23-2005, 11:30 AM
i use:
*.frag
*.vert
*.glsl

Zulfiqar Malik
11-23-2005, 08:23 PM
You can also look into Scintilla (http://www.scintilla.org) which is supported both on windows and linux and has a very nice interface for supporting syntax hi-lighting. It really is pretty easy and great to use because it contains almost all the features of advanced text editors like Visual Studio.
I use extensions
.vsh, .fsh
.vert, .frag
and sometimes
.vsh, .psh

sqrt[-1]
11-23-2005, 09:43 PM
GLIntercept uses Scintilla/Scite for all syntax highlighting. You can run standalone mode or steal all the syntax highlighting config files if you want (GLSL ARB FP/VP NV FP/VP support)

jide
11-24-2005, 03:12 AM
Thank you for the replies. So it seems that it can be of interrest for some of you.

For the direct support inside C/C++ sources, I had a quick look at the vi docs, and it seems it can be supported, however the docs explicitly says it can not work and depends on several things.

I'm pretty sure direct GLSL inside C/C++ sources should be avoided (even if it's true that it can hide the shaders sources, anyone will be able to inspect the binary seeking for strings and find them easily).

Actually, I notice that .vsh and .fsh have been used by several people, so they are the more common extensions (I also used sometimes .glsl but didn't really liked it). I'll also remember for .frag and .vert

skvinay
11-24-2005, 02:51 PM
Hi Jide,

You mentioned:



I'm pretty sure direct GLSL inside C/C++ sources should be avoided (even if it's true that it can hide the shaders sources, anyone will be able to inspect the binary seeking for strings and find them easily).
Im new to glsl. Why do you say this? Is it for security reasons or something else ? If its open source, does it matter ?

Thanks
- Vinay

Humus
11-24-2005, 05:17 PM
I used to use *.fsh for fragment shaders and *.vsh for vertex shaders, but these days I use *.shd and store both vertex and fragment shader in the same file, separated with [Vertex shader] and [Fragment shader] tags.

jide
11-25-2005, 01:56 AM
I said that just because some use to write their shader sources inside their code (C/C++...). And I think one of the main interresting point about shaders is that they can be reused, combined... for different uses. So, having them in a separate file (like I mentionned) just put an emphasis on that reusability and that ability to be combined, depending on the needs.
However, some would argue that writing shaders inside their C code just avoid end-users to be able to see the shader sources. And I guess this is not a real good point (despite of security and spy issues).
And this is why I made this topic, I prefer writing shaders in their own files and read them from the main program. Also, security, spying and such are out of topic here (I think I can remember that it was discussed some months ago).

Humus: the point you stippled is interresting, so I should rather avoid making 2 distinct syntaxes highliting and prefer group them in once (one syntax highlight for all GLSL).

V-man
11-26-2005, 06:05 PM
Besides vsh/fsh
vert/frag
vsh/psh
glsl/glsl
there is
vs/ps
vs/fs
vp/fp (ARB_vp/fp)

I used vert/frag, then combined to single file -> glsl

smileyj
12-30-2005, 03:48 AM
Hope this doesn't scare the editor mode folks too much...

I prefer extensions that start with .gl because they let people who aren't OpenGL shader programmers know that a file is related to OpenGL. I use:

.glvs = vertex shader
.glfs = fragment shader
.glsl = general or shared shading language code

I like keeping vertex and fragment shaders in separate files so that I can try different combinations without having redundant copies of the code that isn't changing much. Fewer copies means fewer fixes if a change is necessary. E.g.

tek-glow-fx.glvs (common vertex shader)
tek-glow-fx-01.glfs (fragment shader variant 1)
...
tek-glow-fx-05.glfs (fragment shader variant 5)

I also create .glsp (shader program) files which specify which .glvs, .glfs, .glsl files get compiled together and which shaders are linked together. A C++ class with a constructor that expects a .glsp filename takes care of the compile and link. There's a member function to install the shader.

Recently, in a mood of rampant proliferation, I've been toying with the idea of .glsi files for specifying the interface (e.g. varying) between a vertex shader and a fragment shader. That makes the interface easy to find, right? :)

glBug
12-30-2005, 04:15 AM
in Emacs you can associate file extensions with a mode of your choice, for example here is what i use:



(setq auto-mode-alist (cons '("README" . text-mode) auto-mode-alist))

(setq auto-mode-alist (cons '("\\.vp$" . arbvp-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.fp$" . arbfp-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.arbvp$" . arbvp-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.arbfp$" . arbfp-mode) auto-mode-alist))

(setq auto-mode-alist (cons '("\\.vert$" . glsl-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.frag$" . glsl-mode) auto-mode-alist))

(setq auto-mode-alist (cons '("\\.cg$" . nvidia-cg-mode) auto-mode-alist))

(setq auto-mode-alist (cons '("\\.m$" . octave-mode) auto-mode-alist))as you can see both .vp and .arbvp extensions will
trigger my mode for editing the !!ARBvp1.0 files.

ScottManDeath
12-31-2005, 09:15 PM
.vertex.cg
.fragment.cg

.vertex.glsl
.fragment.glsl

Haven't used assembly shaders in a while, but would use then the following:

.vertex.asm
.fragment.asm

knackered
01-02-2006, 08:34 AM
for opengl...

.glsl

and for d3d...

.hlsl

I don't really need syntax highlighting for the type of shaders I'm using at the moment. I can only imagine that jide has too much time on his hands - like most people who use linux ;) I prefer actually programming.

jide
01-04-2006, 07:38 AM
Well, when we'll see you Knackered do things not only for your little proud and presomptuous brain but also for others, I guess the earth will have another spin number... :D

Anyway I retain that people use many different extensions, so I'll have to look for how to stipple that in another way (with writting some specific chars in the first line of the source it seems it will work). I'll also send it to the vi mailing list , I hope quiete soon :)

EDIT: Also why speaking of D3D ??? Did I went to the wrong forums ??

glBug
01-04-2006, 03:40 PM
jide, i m not sure if i missed something, but there is already a glsl mode for vim: glsl (http://www.vim.org/scripts/script.php?script_id=1002)
and for nVidia Cg: Cg (http://www.vim.org/scripts/script.php?script_id=581)
and even a hlsl mode hlsl (http://www.vim.org/scripts/script.php?script_id=855)
for those hard working windoze/d3d programmers with
almost no free time ;-)

jide
01-05-2006, 08:45 AM
You're right, I have mailed the author of vi and it seems he wasn't aware of that as he said me it's a good idea. He surely cannot know each syntax highlighting... I didn't mail to the mailing list as I wanted to wait for a best support.

Anyway, all of this is out now :(

Thank you for letting me know that.

knackered
01-05-2006, 02:29 PM
time well spent, jide. Now...onto the programming. Or maybe you'll do some compiler benchmarking first.
I work with people like you - or rather, I do the work while they do everything to avoid it. It's most certainly not funny, you should be ashamed of yourself and thanking me for pointing out the error of your ways, rather than hopelessly trying to construct a decent insult for me.

jide
01-06-2006, 03:58 AM
Originally posted by knackered:
time well spent, jide. Now...onto the programming. Or maybe you'll do some compiler benchmarking first.
I work with people like you - or rather, I do the work while they do everything to avoid it. It's most certainly not funny, you should be ashamed of yourself and thanking me for pointing out the error of your ways, rather than hopelessly trying to construct a decent insult for me.And then ?? You're too clever, you know too much everything so that you never do things that have already been done elsewhere but that you wasn't aware of... That turns out.

I'm not ashamed, why would I feel ashamed ? I still can use it for myself or help them make a better syntax highlighting or better know file extensions and so on. It's not a waste of time.

Also, don't tell you know me please, as you don't. And I wasn't insulting you, I was just speaking the way you usually do.

Well I wonder why I'm proving to you.

knackered
01-06-2006, 09:10 AM
I love you jide, and I want to have your babies.
You've passed the test, the factory is yours!

jide
01-06-2006, 11:27 AM
This really becomes whatever.

If someone could close this topic I would appreciate.

Brolingstanz
01-06-2006, 12:57 PM
*.openglshadinglanguage

what do you guys think? a tad windy? too verbose?

knackered
01-07-2006, 09:59 AM
Originally posted by jide:
This really becomes whatever.

If someone could close this topic I would appreciate.Get on with your work, slacker.


Originally posted by bonehead:
*.openglshadinglanguage

what do you guys think? a tad windy? too verbose?I think it's perfect, bonehead.
But, we could discuss it further - I propose a meeting to decide when we should hold an open forum to accumulate opinions and ideas on the file extensions we should all be using. Then, when all points of view are documented, we can hold a further string of meetings to try to get a short list. From then on, we'll play it by ear.
It's really important that we all agree on a single approach to file extensions. The work can wait - these details are more important. Put it down as R&D.
Seriously though, jide - what made you think this topic was worth discussing on a shading language forum? Is this your main concern at the moment? If it is, then take a deep breath, it's about to get a whole lot more complicated as you rush head long into creating an opengl context.
I fully expect the next topic you post will be titled "variables - what should they be CALLED?"

RigidBody
01-07-2006, 10:30 AM
now that's what i call entertainment.

don't get mad about knackered, jide. remember, we only hurt the ones we love. :D

jide
01-07-2006, 12:25 PM
EDITTED: okay you're right. I was just a bit frustrating...

RigidBody
01-07-2006, 12:57 PM
calm down, man!

first, knackered lives on a small island with bad weather where people were-until some weeks ago- not allowed to have a beer in a pub after 23:00. that's no way to live...

second, i guess he's right in some way. i will tell you my opinion, although you didn't ask for it :D : syntax highlighting for shaders is probably not so important for me and the rest of the world. syntax highlighting for c++ (like in vi or nedit, for example) is a good thing, because a c++ prog grows above one or two thousand lines very quickly, rather than a shader prog.

and third: never, ever post something like "i have an idea to program the following (...) would you like me to do so?". do it or leave it. if you decide to do it, post a link where i can download it, and wait for me to post an answer like either "well done, jide" or "i can do without that ****". do it or don't. that's all. linus torvalds didn't ask "do you want me to program an OS". he just did it. everybody loves him for doing so, so do i. maybe i'll love you one day, too, like the way that knackered does :) - if you program a tool that i need.

and, my french friend, do yourself a favour: edit your last post, filled with personal emotions, before someone else reads it :p

knackered
01-08-2006, 01:59 PM
don't worry jide, I'm always deleting posts I've made because they were written in the heat of the moment. So you're just like me, in at least one respect.
But I've never, ever done anything a german has told me to do, including handing over my small island. So, you're not like me in that respect, jide.

zed
01-08-2006, 04:04 PM
first, knackered lives on a small island with bad weather where people were-until some weeks ago- not allowed to have a beer in a pub after 23:00. that's no way to live...wot its changed!!, wipes a tear from my eye, that is truly wonderous news.
i recall my first time in england(london) me and this brazilian guy got tanked up in the hostel and decided to hit the pubs at 11:30pm, walking around the streets heres me going 'look at all the ppl on the street, this town rocks' it rocked less when i found out all the pubs were shot + soho was the place to go.

and, my french friend, do yourself a favour: edit your last post, filled with personal emotions, before someone else reads itto late, i read the comment about his hands fimilarity of his trouser pockets, well it takes balls to admit it on a pubic forum, i admire your spunk, jide.

RigidBody
01-09-2006, 12:36 AM
well, knackered, if you even offered me your island, i would have to think twice if i want to take it- opening pubs after 23:00 is a good start to make it more attractive, maybe the next step could be hiring some french cooks :p

btw: i gave jide the advice to edit his post, not the command. sorry for my german genauigkeit :D

knackered
01-09-2006, 01:41 AM
2 world wars and 1 world cup.

RigidBody
01-09-2006, 01:45 AM
1. i think it was in "fawlty towers": "don't mention the war!"

2. that was not a goal. but hang on, maybe you'll get a second chance within the next few months. btw- do you know who shot the last goal in wembley stadium before it was closed :cool:

knackered
01-09-2006, 04:00 AM
Jesus, a german with a good sense of humour!
You must be so lonely over there.

RigidBody
01-09-2006, 04:41 AM
nah, rarely... the guys that i drink with share my sense of humour. and, the fact that germans cannot make funny movies does not mean we have a bad sense of humour.

no, i don't feel so lonely at all- except for one thing, maybe...hmm...knackered, do you have a sister?

jide
01-09-2006, 06:57 AM
Hey Knackered, is that a way of speaking ?? I really hate that. I wasn't wanted to say that, but you are immature, that's a fact not a guess. And I'm proud not working for your company, really.

For you german people are fascists, war disciples, they don't have sense of humor..... But where we go ? Where are we also ? Go to Germany then and tell them !! And if you have something wrong with french, do come there and tell us too.

And I'll make you a favor, still don't know why, maybe you're pityfull threw my mind. But I'd like to say you that you're just a fashion victim, no more: all what you say is for your personnal proud, for harassing others, you think you're a cybernethic boy, but you aren't. So go down and try to find out what's inside your head.

I'll ignore you now.

RigidBody
01-09-2006, 07:32 AM
don't take it all too serious, jide. it just seems that life has made knackered a bit of a cynic, which happens quite often to many people. we're not in paradise here...

concerning that english/german thing- once a teacher told us a story: she knew some people from england, and played cricket with them. she was in the winning team, and when she made her victory dance, her english friends said "ok you win- but we won the war". it's not serious, it's just something they are still proud of. they even transfer it to football, every time it's germany versus england. i just hope we will meet the english team this year, because i can't wait to read those funny headlines ("let's blitz fritz" etc.).

furthermore, i don't think knackered wants to say that i'm a fascist, neither all of my fellow citizens. it's not meant in the way that we started two world wars, but rather in the way that they defeated us in two world wars. and in one world cup, which he would insist on, although nowadays we know that they didn't.

to come to an end with that politics stuff:

1. you can't defeat us in another world war because we won't start one again.

2. you can't defeat us in football again unless you clone beckham 9 times and- not to forget- get yourself a real goal keeper.

3. read point 1 and 2 again and accept the fact that there will be no more victories of england against germany in the future :p

knackered
01-09-2006, 02:45 PM
Beautifully put.
What a great guy!
Jide, you could learn a lot from this fella. You've got to rise above my ridicule. If you gave me a good solid reason for why this thread was worth it's storage on the server, I wouldn't have taunted you.
You will meet people like me in life, y'know - think of me as a vaccination (or an arsehole, I really don't care which).