Questions tagged [glsles]

The OpenGL ES Shading Language (also known as GLSL ES or ESSL) is based on the OpenGL Shading Language (GLSL) version 1.20.

The OpenGL ES pipeline contains a programmable vertex stage and a programmable fragment stage. The remaining stages are referred to as fixed function and the application has only limited control over their behavior. The set of compilation units for each programmable stage form a shader.

OpenGL ES 2.0 only supports a single compilation unit per shader. A program is a complete set of shaders that are compiled and linked together.

Resources:

294 questions
23
votes
3 answers

How do you pack one 32 bit integers into 4, 8bit ints in GLSL / WebGL?

I'm looking to parallelize some complex math, and WebGL looks like the perfect way to do it. The problem is, you can only read 8 bit integers from textures. I would ideally like to get 32 bit numbers out of the texture. I had the idea of using the 4…
william malo
  • 2,480
  • 2
  • 18
  • 18
18
votes
3 answers

Index expression must be constant - WebGL/GLSL error

I'm having trouble accessing an array in a fragment shader using a non-constant int as the index. I've removed the formula as it wouldn't make much sense here anyway, but my code is meant to calculate the tileID based on the current pixel and use…
Joey Morani
  • 25,431
  • 32
  • 84
  • 131
17
votes
3 answers

Are 1D Textures Supported in WebGL yet?

I've been trying to find a clear answer, but it seems no one has clearly asked the question. Can I use a 1D sampler and 1D texture in WebGL Chrome, Firefox, Safari, IE, etc? EDIT Understandably 1 is indeed a power of 2 (2^0=1) meaning you could…
Adrian Seeley
  • 2,262
  • 2
  • 29
  • 37
12
votes
2 answers

When switching to GLSL 300, met the following error

when I switch to use OpenGL ES 3 with GLSL 300, I met the following error in my frag shader undeclared identifier gl_FragColor when using GLSL 100, everything is fine.
Adam Lee
  • 24,710
  • 51
  • 156
  • 236
11
votes
1 answer

Should I avoid creating multiple variables when programming a shader?

I'm starting to learn Shaders now (HLSL, GLSL) and I saw a lot of tutorials where there weren't many variables created and that made reading harder. I was wondering if the creation of new variables affect the performance of the shader. So, for…
Hodor
  • 166
  • 1
  • 8
11
votes
3 answers

GLSL-ES Random grainy noise with FP16 limit

I am trying to write a compact and simple noise function with a strictly FP16 limit. This is with what I came out so far, but I think somewhere on the operation the number gets too small for fract or sin, since in the GPU I must write this for these…
PerracoLabs
  • 16,449
  • 15
  • 74
  • 127
9
votes
1 answer

How to declare a function that returns an array in glsl es (version 100)

The following shader method: float[1] GetArray() { float array[1]; array[0] = 1.0; return array; } Gives me: ERROR: 0:1: 'GetArray' : syntax error: Array size must appear after variable name
SeismicSquall
  • 348
  • 2
  • 10
9
votes
3 answers

Three.js - Using multiple textures in a single PointCloud

I'm trying to use multiple textures in a single PointCloud using a ShaderMaterial. I'm passing a texture array to the shader along with texture index attributes and selecting the appropriate texture to use in the fragment shader. Relevant Setup…
mystaticself
  • 91
  • 1
  • 7
9
votes
3 answers

Android Openg GL ES 2 drawing big textures slow

I am very new to OpenGL. I am trying to draw textured quads (2 triangles). The size of texture is 900x900px. I have no problems with one quad but when I trying to draw 5-10 quads I see noticable slow down. Maybe I'm doing something…
mik_os
  • 670
  • 1
  • 6
  • 10
8
votes
2 answers

Rotating a texture on a Fragment Shader in GLSL ES

I'm trying to rotate a texture in a fragment shader, instead of using the vertex shader and matrix transformations. The rotation has the pivot at the center. The algorithm works fine when rendering in a quad with a square shape, but when the quad…
PerracoLabs
  • 16,449
  • 15
  • 74
  • 127
8
votes
3 answers

Using GLSL 3 ES with three.js

Has anyone been successful in using GLSL 3 ES shaders with three.js library? From what I know it is impossible for latest revision (r68) beacuse one can't even set a directive (which is required, and has to be before anything else in shader…
Xyz
  • 1,522
  • 17
  • 23
8
votes
3 answers

glsl es 2.0 inverse matrix

There is no inverse command in glsl es 2.0 But I saw that I can 1.0/mat2 . But I fear it'll just divide component wisely. Or not? But if so, is there some trick for this (get 1/det fast)?
tower120
  • 5,007
  • 6
  • 40
  • 88
7
votes
1 answer

THREE.js/GLSL: WebGL shader to color fragments based on world space position

I have seen solution to color fragments based on their position in screen space or in their local object space like Three.js/GLSL - Convert Pixel Coordinate to World Coordinate. Those are working with screen coordinates and do change when the camera…
nylki
  • 498
  • 5
  • 15
7
votes
2 answers

GLSL ES - Mapping texture from rectangular to polar coordinates with repeating

I need to warp a rectangular texture to texture with polar coordinates. To spread the light on my problem, I am going to illustrate it: I have the image: and I have to deform it using shader to something like this: then I'm going to map it to a…
Nolesh
  • 6,848
  • 12
  • 75
  • 112
7
votes
4 answers

First two fragment shader outputs are different

I'm currently trying to get this bokeh shader to work with GPUImage: http://blenderartists.org/forum/showthread.php?237488-GLSL-depth-of-field-with-bokeh-v2-4-(update) This is what I've got at the moment: precision mediump float; varying highp vec2…
Peter W.
  • 2,323
  • 4
  • 22
  • 42
1
2 3
19 20