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
7
votes
1 answer

GLSL ES precision errors and overflows

I have the following fragment shader: precision highp float; varying highp vec2 vTexCoord; uniform sampler2D uColorTexture; void main () { highp vec4 tmp; tmp = ((texture2D (uColorTexture, vTexCoord) + texture2D (uColorTexture, vTexCoord))…
V1ru8
  • 6,139
  • 4
  • 30
  • 46
7
votes
1 answer

Why does my implementation of a displacement map in Three.js disconnect vertices at the poles of a sphere?

I am trying to create an asteroid by applying a displacement map with perlin noise to a sphere. Everything works as expected except that the poles of the sphere are distorted. It looks like as if the vertices on the poles are disconnected.…
7
votes
1 answer

GLSL Shader Error on Mac, but not Windows: cannot convert from 'const int' to '4-component vector of float'

I'm new to shaders and I started playing around with some of them yesterday. They compile fine on my Windows PC, but when they're ran on Mac, there is an error for both: ERROR: 0:14: '=' : cannot convert from 'const int' to '4-component vector…
DustinRiley
  • 555
  • 6
  • 15
6
votes
1 answer

In a fragment shader, why can't I use a flat input integer to index a uniform array of sampler2D?

I want to specify textures to be used when I render an array of sprites. So I put a texture index in their vertex data, and pass it as a flat value from my vertex shader to my fragment shader, but can't use it to index an array of samplers as…
MarkL
  • 81
  • 2
5
votes
1 answer

OpenGL ES GLSL Mandelbrot with general exponent

I have successfully implemented several fractals on GLSL(OpenGL ES), but I seem to be getting nowhere with the variation of Mandelbrot set where the exponent is an arbitrary positive number. I am doing the exponentiation in complex polar…
comodoro
  • 1,489
  • 1
  • 19
  • 30
5
votes
1 answer

how to add gl transition on video in android with ffmpeg?

GLSL transition on video and render with ffmpeg, but i cannot find proper solution to how to add GLES transition in ffmpeg command. click here ffmpeg-gl-transition I already try above solution but it gives errors and not work. Not be understand…
5
votes
1 answer

How to Convert GLSL #version 330 core to GLSL ES #version 100?

I'm trying to make an app that draws an image in Android Studio with NDK and JNI to call C++ Code using OpenGL ES. I have went through the tutorial how to do this in OpenGL at : https://learnopengl.com/#!Getting-started/Textures, which use GLSL 330…
Toan Tran
  • 476
  • 6
  • 28
5
votes
1 answer

How to force GLSL branching?

I'm working on a fragment shader. It works, but it still needs some optimisation. As far as I know, most of the cases branches in GLSL are flatten, so both cases are executed. I've eliminated most of the if-else conditions, but there are some of…
Iter Ator
  • 8,226
  • 20
  • 73
  • 164
5
votes
1 answer

WebGL: How to bind values to a mat4 attribute?

In some WebGL application, let's assume that we have a GLSL vertex shader which starts like this: attribute vec4 foo1; attribute vec4 foo2; attribute vec4 foo3; attribute vec4 foo4; and some corresponding Javascript code for binding a data…
IvanSanchez
  • 18,272
  • 3
  • 30
  • 45
5
votes
2 answers

Profiling graphics shaders

For quite some time, I've been avoiding branching in my shader code by, instead of float invert_value(in float value) { if(value == 0.0) return 0.0; else return 1.0 / value; } writing 'clever' code like this float invert_value_ifless(in…
Leszek
  • 1,181
  • 1
  • 10
  • 21
5
votes
4 answers

Passing values between SCNShadable entry points

In an OpenGL program you typical declare something like this in a vertex shader varying bool aBooleanVariable; and then read the value in the fragment shader. How do you do this within the framework of an SCNShadable entry point? For example from…
Cameron Lowell Palmer
  • 21,528
  • 7
  • 125
  • 126
5
votes
2 answers

How to write const array in GLSL ES

I am trying to write a simple vertex shader for an OpenGL ES app on the iPhone, but my array constructor is causing me trouble. attribute vec4 normal; attribute vec4 position; void main(void){ const vec4 vertices[3] = vec4[](vec4(0.25, -0.25,…
Oliver
  • 111
  • 2
  • 10
5
votes
1 answer

OpenGL 4 and ES 3.0 discrepancy with packHalf2x16 / unpackHalf2x16

I would very much have wished to ask a succinct question that allows a clear answer, but I fear there are too many minor things I don't fully understand regarding FBO initialization that I need to clear up. I'm writing a deferred shader targeting…
swalog
  • 4,403
  • 3
  • 32
  • 60
5
votes
1 answer

glsl es dFdx/dFdy analog

I'm writing crossplatform application. It should run on Android devices. I want to use dFdx/dFdy for antialiasing. But, unfortunately, glsl es 2.0 does not support derivatives. Can I replace dFdx/dFdy with something? I.E. 1/sprite_width,…
tower120
  • 5,007
  • 6
  • 40
  • 88
5
votes
2 answers

Is compiling a shader during rendering a good / valid practice in OpenGL ES?

System: Android 4.03, OpenGL ES 2.0 Problem: When glAttachShader is invoked after the first frame has already been rendered with another program / shader, some devices (Galaxy S3) crash with a "GL_INVALID_VALUE" error (no further details are…
Jan_K
  • 51
  • 6
1
2
3
19 20