Questions tagged [glsl]

The OpenGL Shading Language (GLSL) is the standard programming language for shaders in OpenGL. There are many versions of the language, with each version corresponding to a version of OpenGL. OpenGL ES 2.0 and above have separate versions of GLSL.

The OpenGL Shading Language (GLSL) is the standard programming language for shaders in OpenGL. There are many versions of the language, with each version corresponding to a version of OpenGL. OpenGL ES 2.0 and above have separate versions of GLSL.

Information about GLSL (for desktops) can be found on the OpenGL Wiki

Versions

GLSL

OpenGL Shading Language 1.10 Specification, #version 110, OpenGL 2.0
OpenGL Shading Language 1.20 Specification, #version 120, OpenGL 2.1
OpenGL Shading Language 1.30 Specification, #version 130, OpenGL 3.0
OpenGL Shading Language 1.40 Specification, #version 140, OpenGL 3.1
OpenGL Shading Language 1.50 Specification, #version 150, OpenGL 3.2
OpenGL Shading Language 3.30 Specification, #version 330, OpenGL 3.3
OpenGL Shading Language 4.00 Specification, #version 400, OpenGL 4.0
OpenGL Shading Language 4.10 Specification, #version 410, OpenGL 4.1
OpenGL Shading Language 4.20 Specification, #version 420, OpenGL 4.2
OpenGL Shading Language 4.30 Specification, #version 430, OpenGL 4.3
OpenGL Shading Language 4.40 Specification, #version 440, OpenGL 4.4
OpenGL Shading Language 4.50 Specification, #version 450, OpenGL 4.5
OpenGL Shading Language 4.60 Specification, #version 460, OpenGL 4.6

GLSL ES

OpenGL ES Shading Language 1.00 Specification, #version 100 es, OpenGL ES 1.0
OpenGL ES Shading Language 3.00 Specification, #version 300 es, OpenGL ES 3.0
OpenGL ES Shading Language 3.10 Specification, #version 310 es, OpenGL ES 3.2
OpenGL ES Shading Language 3.20 Specification, #version 320 es, OpenGL ES 3.2

8020 questions
3
votes
1 answer

OpenGL Implementing MultiPass

I am having trouble porting some code I have successfully implemented in Shadertoy to desktop OpenGL, the problem is that I need to create a FrameBufferObject FBO so that I can do offscreen computations that will be later passed on to the main glsl…
Felipe Gutierrez
  • 675
  • 6
  • 17
3
votes
0 answers

Implementing anisotropic lighting for planar surfaces

I am trying to emulate some kind of specular reflections through anisotropy in my WebGL shader, something like this described in this tutorial here. I realized that while is easy to get convincing results with spherical shapes like the Utah teapot,…
deblocker
  • 7,629
  • 2
  • 24
  • 59
3
votes
1 answer

Problems using GLTexImage3D correctly

This is how I give the Bitmaps to OpenGL. (C#) public static int Generate3DTexture( string[] names ) // file paths { //basically merging the images into one vertical column of images MagickImageCollection allimages = new…
gunfulker
  • 678
  • 6
  • 23
3
votes
1 answer

Is it ok to declare an oversized output array in fragment shader and leave some indices unused?

Some context: I'm looking for a simple way to run 'old' shaders (let's say #version 120) on a 'new' GLSL (let's say #version 150 core). So far I came up with adding following header to my fragment shaders when targeting #version 150: #version 150…
HolyBlackCat
  • 78,603
  • 9
  • 131
  • 207
3
votes
0 answers

Why is wrapping coordinates not making my simplex noise tile seamlessly?

I've been trying to create a fake 3D texture that repeats in shadertoy (see here, use wasd to move, arrow keys to rotate) But as you can see, it doesn't tile. I generate the noise myself, and I've isolated the noise generation in this minimal…
Krupip
  • 4,404
  • 2
  • 32
  • 54
3
votes
1 answer

Does GLSL support C-style initializers or not?

From the OpenGL Wiki page on "Data Type (GLSL)", I found a pretty broad statement about initializer lists. ...Therefore, GLSL takes a feature from C++11 and allows the initialization of any type by using an initializer list. An initializer list…
John P
  • 1,463
  • 3
  • 19
  • 39
3
votes
0 answers

Is there any way to pass an array to a shader in glium?

I tried to do this with a uniform-block: Rust: #[derive(Copy, Clone)] struct Circle { position: (f32, f32), radius: u32, _padding: u32, } #[derive(Copy, Clone)] struct UniformBlock { map: [Circle;…
aitvann
  • 1,289
  • 2
  • 8
  • 10
3
votes
1 answer

Bump Mapping with javascript and glsl

/** * A class creating buffers for a textured box to render it with WebGL */ class RasterTextureBox { /** * Creates all WebGL buffers for the textured box * 6 ------- 7 …
Lisalein
  • 51
  • 3
3
votes
2 answers

free software for debugging shaders

Are there any free software tools to debug GLSL shaders?
Daryna
  • 749
  • 1
  • 7
  • 11
3
votes
2 answers

UBO padding of uint64_t typed array

I have the following situation. UBO structure that holds 4 uint64_t in an array. struct MaterialData{ uint64_t comps[4]; }; layout (std140, binding = 0) uniform MaterialBlock { MaterialData data[50]; }material; The problem…
Michael IV
  • 11,016
  • 12
  • 92
  • 223
3
votes
1 answer

How to make this code work on Mesa3d?

This GLSL code compile and run warningless in ATI's OpenGL: void main() { vec4 tmp = gl_ModelViewMatrix * gl_Vertex; tmp.xyz = tmp.xyz / (1 - tmp.w); tmp.w = 1; gl_Position = gl_ProjectionMatrix * tmp; gl_FrontColor = gl_Color; } Why does…
lvella
  • 12,754
  • 11
  • 54
  • 106
3
votes
1 answer

gl_VertexID breaks rendering

I have the following GLSL shader (being loaded into an OpenGL 3.3 forward context, but I get the same behavior in 2.1): const GLchar* const glsl_vertex_timeseries = { "#version 330\n" "#extension GL_EXT_gpu_shader4 : enable\n" "" "in…
Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
3
votes
3 answers

What is the role of gl_Position.w in Vulkan?

Variable gl_Position output from a GLSL vertex shader must have 4 coordinates. In OpenGL, it seems w coordinate is used to scale the vector, by dividing the other coordinates by it. What is the purpose of w in Vulkan?
lvella
  • 12,754
  • 11
  • 54
  • 106
3
votes
1 answer

gaussian blur in webgl error

I am trying to write a simple gaussian blur shader in webgl. i have searched a lot about this and i think i understand the idea behind it. given this 3X3 kernel .how can i apply it to my vertex shader? Here is my current output [ 0.0625 0.125 …
anekix
  • 2,393
  • 2
  • 30
  • 57
3
votes
1 answer

oct tree generation going wrong at the last step

NOTE: THIS QUESTION HAS BEEN DRASTICALLY EDITED FROM ITS ORIGINAL FORM I am attempting to create a logarithmic raytracer by implementing an oct tree data structure combined with voxelization to achieve fast ray tracing. Currently I am having issues…
Makogan
  • 8,208
  • 7
  • 44
  • 112