GLSL

1 program Added 2026-02-22T21:54:26Z Agent: claude-codeModel: claude-sonnet-4-6WebSearch: disabled Evidence Report issue View issues
Aliases: OpenGL Shading Language, OpenGL GLSL
Provenance: commit 4ff968db67 · authored 2026-02-22T22:54:53+01:00 · agent claude-code · model claude-sonnet-4-6

Sources mentioning this language

8 sources · pl_id: pl/glsl
LLM (this repo) · 1PldbLinguistPygmentsWikipediaHyperpolyglotRosettacodeWikidata · Q779819

Wikipedia infobox

Pulled from the wikimedia/structured-wikipedia snapshot — see data/raw/wikipedia_pl_facts.*.jsonl and pl_fact.csv for the long-table provenance.

Designed byKhronos Group
First appeared2002
Homepagehttps://www.opengl.org/

Extensions claimed by this language

26 claims. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.glsllinguistprimary1.2M files
.vertpygmentsprimary603.1K files
.fplinguistsecondary62.1K files
.fraglinguistsecondary781.0K files
.fragpygmentssecondary781.0K files
.frglinguistsecondary6.4K files
.fslinguistsecondary2.4M files
.fshlinguistsecondary157.7K files
.fshaderlinguistsecondary2.1K files
.geolinguistsecondary115.4K files
.geopygmentssecondary115.4K files
.geomlinguistsecondary31.4K files
.glslflinguistsecondary4.7K files
.glslvlinguistsecondary3.7K files
.gslinguistsecondary257.9K files
.gshaderlinguistsecondary14 files
.rchitlinguistsecondary4.5K files
.rmisslinguistsecondary1.9K files
.shaderlinguistsecondary759.5K files
.tesclinguistsecondary3.8K files
.teselinguistsecondary3.4K files
.vertlinguistsecondary603.1K files
.vrxlinguistsecondary4.0K files
.vslinguistsecondary137.8K files
.vshlinguistsecondary60.3K files
.vshaderlinguistsecondary1.4K files

Related languages

OpenGL Shading Language (0.82)Open Shading Language (0.59)Metal (0.45)Metal Shading Language (0.45)HLSL (0.40)

LLM-contributed programs

Phong Lighting Fragment Shader

Provenance: commit 4ff968db67 · authored 2026-02-22T22:54:53+01:00 · agent claude-code · model claude-sonnet-4-6 · WebSearch disabled
code.glsl · added: 2026-02-22T21:54:26Z
#version 330 core

in vec3 FragPos;
in vec3 Normal;

out vec4 FragColor;

uniform vec3 lightPos;
uniform vec3 viewPos;
uniform vec3 lightColor;
uniform vec3 objectColor;

void main()
{
    // Ambient
    float ambientStrength = 0.1;
    vec3 ambient = ambientStrength * lightColor;

    // Diffuse
    vec3 norm = normalize(Normal);
    vec3 lightDir = normalize(lightPos - FragPos);
    float diff = max(dot(norm, lightDir), 0.0);
    vec3 diffuse = diff * lightColor;

    // Specular
    float specularStrength = 0.5;
    vec3 viewDir = normalize(viewPos - FragPos);
    vec3 reflectDir = reflect(-lightDir, norm);
    float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32.0);
    vec3 specular = specularStrength * spec * lightColor;

    vec3 result = (ambient + diffuse + specular) * objectColor;
    FragColor = vec4(result, 1.0);
}

Real programs from Software Heritage

4 samples mined from derived_datasets/<date>/contents/*.parquet, byte-verified against the SWH archive. Citation-grade qualified SWHIDs preserved.
mixTexture.vs · 362 B · ext .vs · seen 32× in SWH
via fallback
swh:1:cnt:7ff5f606d7528032b44eceeea1e58e135d81ab9e;origin=https://github.com/leguiart/ProyectoCGA;anchor=swh:1:rev:88f2e4ce5d1a143819e79074175f83773e99e15c;path=/Shaders/mixTexture.vs
Open in SWH · Raw bytes (SWH) · GitHub raw
Show source
#version 330 core
layout(location=0) in vec3 in_position;
layout(location=1) in vec3 in_color;
layout(location=2) in vec2 in_texCoord;

out vec3 ex_Color;
out vec2 ex_texCoord;

void main(){
    gl_Position = vec4(in_position, 1);
    // Just pass the color through directly.
    ex_Color = in_color;
    ex_texCoord = vec2(in_texCoord.x, 1.0 - in_texCoord.y);
}
envobject.geom · 1397 B · ext .geom · seen 7× in SWH
via fallback
swh:1:cnt:0ccd6f17316e570dbec2bb45e805649907925d71;origin=https://github.com/kavika13/overgrowth-scripts;anchor=swh:1:rev:8538f3b53a2d51f2afb466c0d1217d71dc4ee80e;path=/Data/GLSL/envobject.geom
Open in SWH · Raw bytes (SWH) · GitHub raw
Show source
#version 400

layout(triangles) in;
layout(triangle_strip) out;
layout(max_vertices = 256) out;

uniform float time;
uniform mat4 projection_view_mat;

in vec2 frag_tex_coords[];
in mat3 tan_to_obj[];
out vec2 frag_tex_coords_fs;
out mat3 tan_to_obj_fs;

#define USE_GEOM_SHADER

void AddVert(vec3 bary, float height){
     gl_Position = projection_view_mat * (inverse(projection_view_mat)*(gl_PositionIn[0] * bary[0] + gl_PositionIn[1] * bary[1] + gl_PositionIn[2] * bary[2]) + vec4(tan_to_obj[0]*vec3(0,0,height),0));
     frag_tex_coords_fs = frag_tex_coords[0] * bary[0] + frag_tex_coords[1] * bary[1] + frag_tex_coords[2] * bary[2];
     tan_to_obj_fs = tan_to_obj[0] * bary[0] + tan_to_obj[1] * bary[1] + tan_to_obj[2] * bary[2];
     EmitVertex();
 }

void main()
{
   for(int i = 0; i < gl_VerticesIn; i++)
   {
     gl_Position = gl_PositionIn[i];
     frag_tex_coords_fs = frag_tex_coords[i];
     tan_to_obj_fs = tan_to_obj[i];
     EmitVertex();
   }
   EndPrimitive();

   for(int i=0; i<8; ++i){
    for(int j=0; j<8; ++j){
        float x = (i)/8.0;
        float y = (j)/8.0;
        vec3 pos;
        pos = mix(vec3(0,0,1), vec3(1,0,0), x);
        pos = mix(pos, vec3(0,1,0), y);
        pos[2] = 1.0 - pos[0] - pos[1];
        AddVert(pos, 0.0);
        AddVert(pos+vec3(0.05,0.0,-0.05), 1.0);
        AddVert(pos+vec3(0.1,0.0,-0.1), 0.0);
        EndPrimitive();
    }
   }

}
shd_solid_color.vsh · 182 B · ext .vsh · seen 3× in SWH
via fallback
swh:1:cnt:301769c94296606ad68f37e78cfcecdb99d31abb;origin=https://github.com/DragoniteSpam-GameMaker-Tutorials/Bombadier;anchor=swh:1:rev:a7fbbe5b5159b162d516536ccd992900dfc06ae2;path=/shaders/shd_solid_color/shd_solid_color.vsh
Open in SWH · Raw bytes (SWH) · GitHub raw
Show source
attribute vec3 in_Position;
attribute vec3 in_Normal;
attribute vec4 in_Colour;

void main() {
    gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * vec4(in_Position, 1.0);
}
specular_static.vsh · 1327 B · ext .vsh · seen 2× in SWH
via fallback
swh:1:cnt:3aa207b1a3db58d7035820467fd9ea9767031405;origin=https://github.com/romanalexander/jedi-academy;anchor=swh:1:rev:d5ee0a8fc6a1fbb7f655f67485bea0f7345a6e50;path=/code/x_shaders/specular_static.vsh
Open in SWH · Raw bytes (SWH) · GitHub raw
Show source
;------------------------------------------------------------------------------
; Vertex components (as specified in the vertex DECL)
;    v0  = pVertex[i].p
;    v1  = pVertex[i].n
;    v2  = pVertex[i].t0
;    v3  = pVertex[i].basis.vTangent;
;------------------------------------------------------------------------------
xvs.1.1

#include "../win32/shader_constants.h"

#pragma screenspace

; Transform position for world, view, and projection matrices
m4x4 oPos, v0, c[CV_WORLDVIEWPROJ_0]

; Multiply by 1/w and add viewport offset.
; r12 is a read-only alias for oPos.
rcc r1.x, r12.w
mad oPos.xyz, r12, r1.x, c[CV_VIEWPORT_OFFSETS]

; Generate binormal vector
mov r7, v3
mul r8, r7.yzxw, v1.zxyw
mad r8, -r7.zxyw, v1.yzxw, r8	

; Get the light vector
mov r10, c[CV_LIGHT_DIRECTION]

; Move the light vector into tangent space
; Put into T1
dp3 oT1.x, r10, v3
dp3 oT1.y, r10, r8
dp3 oT1.z, r10, v1	

; Get the vector toward the camera
mov r2, -c[CV_CAMERA_DIRECTION]	

; Get the half angle
add r2.xyz, r2.xyz, r10.xyz

; Normalize half angle
dp3 r11.x, r2.xyz, r2.xyz
rsq r11.xyz, r11.x
mul r2.xyz, r2.xyz, r11.xyz

; Move the half angle into tangent space
dp3 oT2.x, r2, v3
dp3 oT2.y, r2, r8
dp3 oT2.z, r2, v1

; Move the bump map coordinates into t0
mov oT0.xyz, v2

Disambiguation rules

Linguist heuristic rules that predict this language when one of its claimed extensions is shared with another.
RuleExtKindPredicates (truncated)
h/linguist/.gs/0.gspredicates[{"kind": "any", "regexes": ["^#version\\s+[0-9]+\\b"]}]
h/linguist/.fs/2.fspredicates[{"kind": "any", "regexes": ["^\\s*(#version|precision|uniform|varying|vec[234])"]}]

Contribute — propose a file extension

Tell us where to find evidence about GLSL (mapped to pl/glsl). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/GLSL/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← glpk-lib gltf →