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

Update a QImage using a shader in QOpenGLWidget

I have a simple vertex shader static const char *vertexShader= "attribute vec4 vPosition; \n" "void main(){\n" "gl_Position = vPosition;\n" "}"; Also I have a shader which creates a "Billboard" effect on an…
Pavel Melnikov
  • 105
  • 2
  • 11
3
votes
1 answer

Per instance UV texture mapping in Three.js InstancedBufferGeometry

I have a InstancedBufferGeometry made up of a single Plane: const plane = new THREE.PlaneBufferGeometry(100, 100, 1, 1); const geometry = new THREE.InstancedBufferGeometry(); geometry.maxInstancedCount = 100; geometry.attributes.position =…
Jack Wild
  • 2,072
  • 6
  • 27
  • 39
3
votes
1 answer

No output from tessellation shader?

I have been working on a terrain LOD algorithm, but the primary logic is on the CPU: I tried to convert most of the logic to the tessellation control and evaluation phases of the opengl pipeline, but nothing is displayed: I reduced the code to a…
Kyy13
  • 315
  • 1
  • 9
3
votes
1 answer

How to acquire the sampler2D type from a Shader Storage Buffer Object inside a shader?

I am trying to get a variable of type sampler2D into my shaders without using an uniform variable. Instead, I want to hand it over using a Shader Storage Buffer Object (SSBO). What type of variable must be declared in the structure to hand over? How…
dagute
  • 93
  • 8
3
votes
1 answer

How to get homogeneous screen space coordinates in openGL

I'm studying opengl and I'v got i little 3d scene with some objects. In GLSL vertex shader I multiply vertexes on matixes like this: vertexPos= viewMatrix * worldMatrix * modelMatrix * gl_Vertex; gl_Position = vertexPos; vertexPos is a vec4 varying…
3dmodels
  • 103
  • 7
3
votes
1 answer

GPU Skeletal Animation and Normals. Is there fast way to get transpose(inverse(m))?

Writing hardware skinning for my game and need to animate normals too. From this article I learned that usually to transform normals you need something like this: transformed_normal = transpose(inverse(bone[i])) * normal; I can't pass second set of…
Tony Forge
  • 51
  • 4
3
votes
1 answer

Opengl 3+ draw lines with differents colors

I'm using SIFT algorithm and I want to draw lines between keypoints in differents image. I made it, but actually, all my lines have the same color so it's unreadable. What I want to achieve is to set a random color to each line, but 1 and only 1…
Raph Schim
  • 528
  • 7
  • 30
3
votes
0 answers

Reinterpret bits cast float ->int in GLSL

I need the GLSL equivalent of float f; int i = *(int *)&f; I know that there is floatBitsToInt() , but unfortunately it's in 3.3 GL version and upper. I need it for 3.0. Any thoughts?
Marcel
  • 269
  • 2
  • 15
3
votes
1 answer

How to handle big numbers in WebGL GLSL shaders?

How can I handle big numbers, such as the one below, in GLSL? I am supplying a shader with Date.now() as a uniform, which is described as: The Date.now() method returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC. —…
Jason
  • 4,905
  • 1
  • 30
  • 38
3
votes
1 answer

How to implement MeshNormalMaterial in THREE.js by GLSL?

I want to implement a shader like MeshNormalMaterial, but I have no idea how to convert normal to color. In THREE.js: My test1: varying vec3 vNormal; void main(void) { vNormal = abs(normal); gl_Position = matrix_viewProjection *…
user2331095
  • 6,577
  • 8
  • 36
  • 56
3
votes
1 answer

OpenGL Texture drawing as one color

I've found similar posts here, but none help me with my problem. I'm just using basic OpenGL, and trying to draw a triangle with a texture applied. But for some reason the triangle is one solid color. This color happens to be the same color as the…
3
votes
1 answer

How to create a mutli-step radial gradient Fragment shader

I'm using some shader code to create multi-step linear gradients by mixing colors. It works great. I have a radial shader which uses distance. Works fine but I dont know to adapt it to multi-step. How could I approach it? Linear Gradient…
fatlinesofcode
  • 1,647
  • 18
  • 22
3
votes
2 answers

GLSL Unsupported Version

I'm trying to compile GLSL shaders for use in LWJGL with OpenGL. I'm on macOS Sierra. I get the following error when trying to compile the shaders: ERROR: 0:1: '' : version '400' is not supported ERROR: 0:1: '' : syntax error: #version The shader…
Erouax
  • 163
  • 2
  • 10
3
votes
0 answers

Artifacts when computing contours of a zoomed in texture

I have a shader that calculates contour lines based on a parameter in the program, in my case the height value of a mesh. The calculation is performed using standard derivatives as follows: float contourWidth = 0.5; float f = abs( fract( height ) -…
pheelicks
  • 7,461
  • 2
  • 45
  • 50
3
votes
2 answers

Dynamic number of uniform blocks

Running openGL 3.1, the question is simple. From GLSL site, here is how one can define array of uniform buffer blocks: uniform BlockName { vec3 blockMember1, blockMember2; float blockMember3; } multiBlocks[3]; Now, is it possible to have…
Raven
  • 4,783
  • 8
  • 44
  • 75
1 2 3
99
100