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
61
votes
4 answers

Proper way to delete GLSL shader?

My code approaches GLSL shader management in the way, that it creates each shader and the associated program and deletes each shader and program. I recently read http://www.opengl.org/wiki/GLSL_Object and there it is stated that: The shader object,…
rioki
  • 5,988
  • 5
  • 32
  • 55
60
votes
1 answer

Interior Mapping shader self shadowing

I'm tinkering with Joost van Dongen's Interior mapping shader and I'm trying to implement self-shadowing. Still I couldn't quite figure out what coordinates shadow casting light vectors need to be in. You can see somewhat working demo at here I've…
shaderology
  • 599
  • 3
  • 7
57
votes
4 answers

In OpenGL is there a way to get a list of all uniforms & attribs used by a shader program?

I'd like to get a list of all the uniforms & attribs used by a shader program object. glGetAttribLocation() & glGetUniformLocation() can be used to map a string to a location, but what I would really like is the list of strings without having to…
hyperlogic
  • 7,525
  • 7
  • 39
  • 32
56
votes
2 answers

How can I do these image processing tasks using OpenGL ES 2.0 shaders?

How can I perform the following image processing tasks using OpenGL ES 2.0 shaders? Colorspace transform ( RGB/YUV/HSL/Lab ) Swirling of the image Converting to a sketch Converting to an oil painting
Forrest
  • 122,703
  • 20
  • 73
  • 107
56
votes
2 answers

Should I calculate matrices on the GPU or on the CPU?

Should I prefer to calculate matrices on the CPU or GPU? Let's say I have the following matrices P * V * M , should I calculate them on the CPU so that I can send the final matrix to the GPU (GLSL) or should I send those three matrices separately…
Maik Klein
  • 15,548
  • 27
  • 101
  • 197
53
votes
3 answers

Why would it be beneficial to have a separate projection matrix, yet combine model and view matrix?

When you are learning 3D programming, you are taught that it's easiest think in terms of 3 transformation matrices: The Model Matrix. This matrix is individual to every single model and it rotates and scales the object as desired and finally moves…
Mecki
  • 125,244
  • 33
  • 244
  • 253
52
votes
3 answers

What can cause glDrawArrays to generate a GL_INVALID_OPERATION error?

I've been attempting to write a two-pass GPU implementation of the Marching Cubes algorithm, similar to the one detailed in the first chapter of GPU Gems 3, using OpenGL and GLSL. However, the call to glDrawArrays in my first pass consistently fails…
Michael Powell
  • 853
  • 2
  • 9
  • 12
51
votes
1 answer

Should I ever use a `vec3` inside of a uniform buffer or shader storage buffer object?

The vec3 type is a very nice type. It only takes up 3 floats, and I have data that only needs 3 floats. And I want to use one in a structure in a UBO and/or SSBO: layout(std140) uniform UBO { vec4 data1; vec3 data2; float…
Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
49
votes
4 answers

How to calculate Tangent and Binormal?

Talking about bump mapping, specular highlight and these kind of things in OpenGL Shading Language (GLSL) I have: An array of vertices (e.g. {0.2,0.5,0.1, 0.2,0.4,0.5, ...}) An array of normals (e.g. {0.0,0.0,1.0, 0.0,1.0,0.0, ...}) The position of…
user464230
  • 876
  • 2
  • 11
  • 21
49
votes
2 answers

Why does my OpenGL Phong shader behave like a flat shader?

I've been learning OpenGL for the past couple of weeks and I've run into some trouble implementing a Phong shader. It appears to do no interpolation between vertexes despite my use of the smooth qualifier. Am I missing something here? To give credit…
Jonba
  • 1,117
  • 2
  • 11
  • 12
48
votes
6 answers

Tools for GLSL editing

I'm looking for some kind of tool to work with GLSL. I want to experiment with shaders in the WebGL application, so what I'm looking for is something like RenderMonkey. As far as I know - RenderMonkey is not supported anymore, so there must be some…
Juriy
  • 5,009
  • 8
  • 37
  • 52
43
votes
2 answers

How to get a "Glow" shader effect in OpenGL ES 2.0?

I'm writing a 3D app for iOS. I'm new to OpenGL ES 2.0, so I'm still getting myself around writing basic shaders. I really need to implement a "Glow" effect on some of my models, based on the texturing. Here's a sample: . I'm looking for code…
st4wik
  • 476
  • 1
  • 4
  • 5
43
votes
1 answer

What does sampler2D store?

I've read a texture example in OpenGL 2.1. The fragment shader looks like this: #version 120 uniform sampler2D texture; varying vec2 texcoord; void main(void) { gl_FragColor = texture2D(texture, texcoord); } The texcoord is passed from vertex…
Bình Nguyên
  • 2,252
  • 6
  • 32
  • 47
41
votes
3 answers

GLSL multiple shaderprogram VS uniforms switches

I'm working on a shader manager architecture and I have several questions for more advanced people. My current choice oppose two designs which are: 1. Per material shader program => Create one shader program per material used in the…
Profet
  • 944
  • 1
  • 15
  • 22
41
votes
4 answers

How can I improve the performance of my custom OpenGL ES 2.0 depth texture generation?

I have an open source iOS application that uses custom OpenGL ES 2.0 shaders to display 3-D representations of molecular structures. It does this by using procedurally generated sphere and cylinder impostors drawn over rectangles, instead of these…
Brad Larson
  • 170,088
  • 45
  • 397
  • 571