This is a major mode for Emacs providing editing conveniences for the OpenGL Shading Language (GLSL). It currently handles GLSL version 4.6, including many recent Vulkan extensions.
In brief, it provides the following features:
-
Syntax high-lighting for symbols and built-in functions and variables.
-
Indentation for the current line (TAB) and selected region (C-M-</kbd>).
-
Fast switching between 'file.vert' and 'file.frag' with
ff-find-other-file
(S-iso-lefttab). -
Interactive function
glsl-find-man-page
prompts for a GLSL built-in functions which it formats to anopengl.org
URL and finally passes that tobrowse-url
. -
An initial tree-sitter implementation.
The easiest way to install glsl-mode
via MELPA, which
can be setup with the following snippet:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/"))
(package-initialize)
Once that is done, then just refresh the packages and install it with:
- M-x package-refresh-contents
- M-x package-install glsl-mode
Alternatively, you can also install the package using e.g.
use-package with the following
snippet in your .emacs
:
(use-package glsl-mode
:ensure t)
This major mode was originally authored by [email protected] and extended by Jim Hourihan.
Original GLSL mode website: (https://maverick.inria.fr/~Xavier.Decoret/resources/glsl-mode/index.html)
See GLSL 4.6 Spec (PDF) the official reference document for GLSL 4.6.