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
2 answers

Access to 3D array in fragment shader

I'm trying to provide access to a 3-dimensional array of scalar data to a fragment shader, from a Python program using PyOpenGL. In the fragment shader, I declare the a 3d sampler uniform uniform sampler3D vol; and in the Python program I have the…
A. Donda
  • 8,381
  • 2
  • 20
  • 49
3
votes
1 answer

How to texture non-unwrapped model using a cubemap

I have lots of models that ain't unwrapped (they don't have UV coordinates). They are quite complex to unwrap them. Thus, I decided to texture them using a seamless cubemap: [VERT] attribute vec4 a_position; varying vec3 texCoord; uniform mat4…
Nolesh
  • 6,848
  • 12
  • 75
  • 112
3
votes
1 answer

X-Y-Distance from camera to object in vertex shader

I want to show some fog / aerial view in my application. But I only want to use the x,y world distance from camera to the model to determine the appearance. I already managed to get the signed z-distance from camera to the models with this…
User Rebo
  • 3,056
  • 25
  • 30
3
votes
1 answer

PyOpenGL - Minimal glDrawArrays Example

I've seen many minimal PyOpenGL examples, but none of the ones I've found make use of VAOs or glDrawArrays / glDrawElements. Instead they all use glVertex, glut shapes, and occasionally the old glCallList function. I'm now trying to write a minimal…
Codesmith
  • 5,779
  • 5
  • 38
  • 50
3
votes
1 answer

How do I convince glslang to give me reflection information on unsized multidimensional arrays?

I am using glslang in my C++ based Vulkan project to deduce information about shaders that I am using to help automatically build my descriptor sets and descriptor set layouts. I have come to a point that I need to support unsized/runtime-defined…
3
votes
1 answer

How to fix incorrect Blinn-Phong lighting

I am trying to implement Blinn-Phong shading for a single light source within a Vulkan shader but I am getting a result which is not what I expect. The output is shown below: The light position should be behind to the right of the camera, which is…
tester
  • 415
  • 1
  • 5
  • 17
3
votes
1 answer

How to get coordinate of fragment shaders? gl_FragCoord not working

I'm trying to make a Mandelbrot set explorer, which will shade the pixels on the screen based on its coordinate in the window. I've done this before without using shaders but its extremely slow. I can't figure out how to get the position of the…
uhin
  • 33
  • 1
  • 3
3
votes
2 answers

GLSL: How to do switch-like statement

I would like to dynamically invoke an easing based on the data passed into the shader. So in pseudocode: var easing = easings[easingId] var value = easing(point) I'm wondering the best way to accomplish this in GLSL. I could use a switch statement…
user10869858
  • 481
  • 1
  • 3
  • 16
3
votes
1 answer

Make a shader storage buffer in different shader programs accessible

What layout and binding do i have to do to make a (working) shader storage buffer readable in a second shader program? I set up and populated a SSBO which i bound successfully and used in a geometry shader. That shader reads and writes to that SSBO…
prox
  • 31
  • 5
3
votes
1 answer

WebGL interpolate with a reference color inside a triangle

Using regl, I am trying to draw a triangle with WebGL where I can define a color at some reference point inside the triangle, and have the color of the other pixels be a function of their distance to this point. So far, it only works when this…
Ren
  • 35
  • 4
3
votes
1 answer

OpenGL - strange SSAO artifact

I followed the tutorial at Learn OpenGL to implement Screenspace Ambient Occlusion. Things are mostly looking okay besides a strange artifact at the top and bottom of the window. The problem is more obvious moving the camera, when it appears as if…
livin_amuk
  • 1,285
  • 12
  • 26
3
votes
2 answers

Shader - Anti fisheye by "pulling" pixels

I would like to fix the distortion of this image : Sorry for the quality, but this is the best example I could find. I don't know if fixing this distortion is possible (I would like to have straight doors, and a straight ceiling), but basically,…
Xys
  • 8,486
  • 2
  • 38
  • 56
3
votes
0 answers

Three.js - Improving mobile performance (VR cardboard)

I´m developing a mobile VR web-app based on Three.js. To test the app I use two devices: Android NEXUS 5 (with Adreno 330), about 8 years old Android BQ AQUARIS X (with Adreno 506), about 3 years old Here´s what I´m using: GLTF models I load…
spacorum
  • 495
  • 6
  • 16
3
votes
1 answer

Three.js uniform dashed line relative to camera

I'm working to display geometric figures in 3D, using three.js. When you draw (by hand) hidden lines as dashed lines, the 'dashes' are regular for all them. This means that a line parallel to the camera plane or a line (nearly) perpendicular to the…
Basil Gass
  • 332
  • 3
  • 15
3
votes
1 answer

GLSL Shader Unwanted Grayscale Effect

Let me preface this with the fact that I am very new to GLSL. I am attempting to use a shader to add a blur effect to slot reel symbols while they spin. I have a working blur effect going, which I have commented out just for simplicity and isolating…