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

Applying a perspective transformation matrix from GIMP into a GLSL shader

So I'm trying to add a rotation and a perspective effect to an image into the vertex shader. The rotation works just fine but I'm unable to make the perspective effect. I'm working in 2D. The rotation matrix is generated from the code but the…
Winter
  • 3,894
  • 7
  • 24
  • 56
3
votes
1 answer

Multiple texture output data in fragment shader

I'm trying to use the GPU for solving an algorithm and I'm using shaders to do so (not compute shaders, just vertex and fragment shaders). For this purpose I need in my fragment shader two output variable for extracting data, I have no problem with…
Mr Nobody
  • 43
  • 4
3
votes
1 answer

Pixel scaling algorithm problems with GPU shader

So I'm working on some pixel shaders for good old emulators like Super Nintendo. You have the classic algorithms like HQnx, 2xSaI, etc, and they are definitely written to run on CPUs and be scaled exactly to twice the size before blitting to the…
Maister
  • 4,978
  • 1
  • 31
  • 34
3
votes
1 answer

glTexImage2D, in random and occasional ways, expends 800 times more in executing

I'm using glsl 2.0 for some GPGPU purposes (I know, not the best for GPGPU). I have a reduction phase for matrix multiplication in which I have to constantly reduce the texture size (I'm using glTexImage2D). The pseudocode is something like this: //…
Keles
  • 369
  • 1
  • 2
  • 14
3
votes
1 answer

How to prevent interpolation of vertex colors in THREE.js shader?

I am trying to write a shader that draws contour plots on meshes. Here is an example of contour plot. My first aim is visualizing one triangle face with different colors. You can find the code that I am using in here. …
3
votes
2 answers

Implementing a gooey effect with a shader (Processing 3)

I'm trying to replicate a web design trick known as "gooey effect" (see it live here). It's a technique applying SVG filters on moving ellipses in order to get a blob-like motion. The process is rather simple: apply a gaussian blur increase the…
solub
  • 1,291
  • 17
  • 40
3
votes
1 answer

How to implement a Color Matrix Filter in a GLSL shader

I would like to implement a Color Matrix Filter in a GLSL shader but couldn't find any documentation regarding this matter. I'm totaly new to the world of shaders (never coded one myself) so please forgive me if my explanation/vocabulary doesn't…
solub
  • 1,291
  • 17
  • 40
3
votes
1 answer

Why is the sprite not rendering in OpenGL?

I am trying to render a 2D(Screen coordinated) sprite in OpenGL. Yet, when I compile it, it does not show up. I see that the code is fine (There are not even any shader compilation errors nor any other errors). I also have also the matrices set…
Ruks
  • 3,886
  • 1
  • 10
  • 22
3
votes
1 answer

How to get the viewing angle relative to the normal in a GLSL fragment shader?

I'm just getting started with shaders in openframeworks, and am trying to write a fragment shader that changes the color of the fragment based on what angle its viewed from. For example, given a rectangle, if viewed from head on (camera is parallel…
TheInnerParty
  • 396
  • 2
  • 13
3
votes
1 answer

Why does my GLSL shader fail compilation with no error message?

I'm building a game using OpenGL and C++. I'm using GLFW and GLAD. I'm currently in the process of setting up simple shaders, but I'm completely roadblocked by a compilation problem. In a nutshell, shader compilation fails with no error…
Grimelios
  • 351
  • 2
  • 11
3
votes
1 answer

How to handle incorrect index calculation for discretized ray tracing?

The situation si as follows. I am trying to implement a linear voxel search in a glsl shader for efficient voxel ray tracing. In toehr words, I have a 3D texture and I am ray tracing on it but I am trying to ray trace such that I only ever check…
Makogan
  • 8,208
  • 7
  • 44
  • 112
3
votes
0 answers

Water refraction causing odd effects, and wont go above 1.0

I've been trying to generate water effects via fragment shader in shader toy. Right now I'm trying to use octave ridge noise multifractals in order to generate a water-like surface. So far, this works fine. The next step I wanted to take was…
Krupip
  • 4,404
  • 2
  • 32
  • 54
3
votes
1 answer

Coloring rectangle in function of distance to nearest edge produces weird result in diagonals

I'm trying to color a rectangle in ShaderToy/GLSL in function of each pixel's distance to the nearest rectangle edge. However, a weird (darker) result can be seen on its diagonals: I'm using the rectangle UV coordinates for it, with the following…
Ivelate
  • 298
  • 2
  • 10
3
votes
1 answer

Opengl Simple Fragment Shader to overlay semi-transparent Triangle Strip over texture

I have a textured triangle strip that forms a quad. when you click on it i want the surrounding areas to get marked with semi-transparent quads so you can still see the textures underneath. i have the quads getting displayed correctly, but they…
cuatro
  • 103
  • 2
  • 9
3
votes
1 answer

Draw a line segment in a fragment shader

I'm struggling to understand the following code, the idea is to draw a simple segment in a fragment shader. I tried to decompose it but I still don't get the ??? line. It would be awesome to have a nice explanation. I couldn't find anything on SO or…
Kirell
  • 9,228
  • 4
  • 46
  • 61