【vs2005】 GLSL 语法高亮

用VS编写着色语言脚本时,很希望语法高亮,而非一片黑压压的代码。网上搜了一下,发现:

http://hi.baidu.com/yowsah/item/bceb342cdad7aa0e73863ef9 这篇里介绍的

NShader( http://nshader.codeplex.com/)貌似很好用,

其支持了如下文件的关键字高亮显示:
NShader uses a specific shader language highlighting based on the following file extensions :

    • .fx, .fxh, .hlsl, .vsh, .psh files : HLSL syntax highlighter.
    • .glsl, .frag, .vert, .fp, .vp, .geom files : GLSL syntax highlighter.
    • .cg, .cgfx, files : CG syntax highlighter.

但可惜只支持VS2008、2010.

由于项目的需要,目前小本只够安装VS2005(悲催的20G C盘啊!!)

于是乎继续寻找。

发现这篇: http://blog.csdn.net/qiul12345/article/details/6695364

比较详细地介绍了如何在VS2005中添加 Cg和HLSL 高亮语法关键词。

于是想到如法炮制,找到GLSL的关键词,将其添加进Microsoft Visual Studio 9.0\Common7\IDE下的usertype.dat文件(若没有,则自己建一个)中。

然后对VS进得一下设置。

打开 tool”-> options” -> text editor” -> file extension”,在右边的扩展名写上glsl, frag,vert,选择VC++编译器。点击Add,再ok。然后重启VS2005.

 

 

 

那其中的关键字有哪些呢?! 于是下了NShader的源码,从中找到GLSLKeywords.map 文件

将其中的单词作为关键字即可。

附:关键字 (每行一个)

abs
acos
all
any
asin
atan
ceil
clamp
cos
cross
degrees
dFdx
dFdy
distance
dot
equal
exp
exp2
faceforward
floor
fract
ftransform
fwidth
greaterThan
greaterThanEqual
inversesqrt
length
lessThan
lessThanEqual
log
log2
matrixcompmult
max
min
mix
mod
noise1
noise2
noise3
noise4
normalize
not
notEqual
pow
radians
reflect
refract
shadow1D
shadow1DLod
shadow1DProj
shadow1DProjLod
shadow2D
shadow2DLod
shadow2DProj
shadow2DProjLod
sign
sin
smoothstep
sqrt
step
tan
texelFetch
texelFetchOffset
texture
texture1D
texture1DLod
texture1DProj
texture1DProjLod
texture2D
texture2DLod
texture2DProj
texture2DProjLod
texture3D
texture3DLod
texture3DProj
texture3DProjLod
textureCube
textureCubeLod
textureGrad
textureGradOffset
textureLod
textureLodOffset
textureOffset
textureProj
textureProjGrad
textureProjGradOffset
textureProjLod
textureProjLodOffset
textureProjOffset
textureSize
active
asm
attribute
break
case
cast
centroid
class
common
const
continue
default
discard
do
else
enum
extern
external
false
filter
fixed
flat
for
foreach
goto
highp
if
in
inline
inout
input
interface
invariant
layout
lowp
mediump
namespace
noinline
noperspective
out
output
packed
partition
patch
precision
public
return
row_major
sample
sizeof
smooth
static
struct
subroutine
superp
switch
template
this
true
typedef
uniform
union
using
varying
volatile
while
false
true
gl_BackColor
gl_BackLightModelProduct
gl_BackLightProduct
gl_BackMaterial
gl_BackSecondaryColor
gl_ClipPlane
gl_ClipVertex
gl_Color
gl_DepthRange
gl_DepthRangeParameters
gl_EyePlaneQ
gl_EyePlaneR
gl_EyePlaneS
gl_EyePlaneT
gl_Fog
gl_FogCoord
gl_FogFragCoord
gl_FogParameters
gl_FragColor
gl_FragCoord
gl_FragData
gl_FragDepth
gl_FrontColor
gl_FrontFacing
gl_FrontLightModelProduct
gl_FrontLightProduct
gl_FrontMaterial
gl_FrontSecondaryColor
gl_LightModel
gl_LightModelParameters
gl_LightModelProducts
gl_LightProducts
gl_LightSource
gl_LightSourceParameters
gl_MaterialParameters
gl_MaxClipPlanes
gl_MaxCombinedTextureImageUnits
gl_MaxDrawBuffers
gl_MaxFragmentUniformComponents
gl_MaxLights
gl_MaxTextureCoords
gl_MaxTextureImageUnits
gl_MaxTextureUnits
gl_MaxVaryingFloats
gl_MaxVertexAttribs
gl_MaxVertexTextureImageUnits
gl_MaxVertexUniformComponents
gl_ModelViewMatrix
gl_ModelViewMatrixInverse
gl_ModelViewMatrixInverseTranspose
gl_ModelViewMatrixTranspose
gl_ModelViewProjectionMatrix
gl_ModelViewProjectionMatrixInverse
gl_ModelViewProjectionMatrixInverseTranspose
gl_ModelViewProjectionMatrixTranspose
gl_MultiTexCoord0
gl_MultiTexCoord1
gl_MultiTexCoord10
gl_MultiTexCoord11
gl_MultiTexCoord2
gl_MultiTexCoord3
gl_MultiTexCoord4
gl_MultiTexCoord5
gl_MultiTexCoord6
gl_MultiTexCoord7
gl_MultiTexCoord8
gl_MultiTexCoord9
gl_Normal
gl_NormalMatrix
gl_NormalScale
gl_ObjectPlaneQ
gl_ObjectPlaneR
gl_ObjectPlaneS
gl_ObjectPlaneT
gl_Point
gl_PointParameters
gl_PointSize
gl_Position
gl_ProjectionMatrix
gl_ProjectionMatrixInverse
gl_ProjectionMatrixInverseTranspose
gl_ProjectionMatrixTranspose
gl_SecondaryColor
gl_TexCoord
gl_TextureEnvColor
gl_TextureMatrix
gl_TextureMatrixInverse
gl_TextureMatrixInverseTranspose
gl_TextureMatrixTranspose
gl_Vertex
bool
bvec2
bvec3
bvec4
dmat2
dmat2x2
dmat2x3
dmat2x4
dmat3
dmat3x2
dmat3x3
dmat3x4
dmat4
dmat4x2
dmat4x3
dmat4x4
double
dvec2
dvec3
dvec4
float
fvec2
fvec3
fvec4
half
hvec2
hvec3
hvec4
int
isampler1D
isampler1DArray
isampler2D
isampler2DArray
isampler2DMS
isampler2DMSArray
isampler2DRect
isampler3D
isamplerBuffer
isamplerCube
isamplerCubeArray
ivec2
ivec3
ivec4
long
mat2
mat2x2
mat2x3
mat2x4
mat3
mat3x2
mat3x3
mat3x4
mat4
mat4x2
mat4x3
mat4x4
sampler1D
sampler1DArray
sampler1DArrayShadow
sampler1DShadow
sampler2D
sampler2DArray
sampler2DArrayShadow
sampler2DMS
sampler2DMSArray
sampler2DRect
sampler2DRectShadow
sampler2DShadow
sampler3D
sampler3DRect
samplerBuffer
samplerCube
samplerCubeArray
samplerCubeArrayShadow
samplerCubeShadow
short
uint
unsigned
usampler1D
usampler1DArray
usampler2D
usampler2DArray
usampler2DMS
usampler2DMSArray
usampler2DRect
usampler3D
usamplerBuffer
usamplerCube
usamplerCubeArray
uvec2
uvec3
uvec4
vec2
vec3
vec4
void

 

 

posted on 2012-06-10 11:25  没有什么能够阻挡  阅读(2780)  评论(0编辑  收藏  举报

导航