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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
22 views

GLSL "flat" qualifier with geometry shader

I'm building a finite element engine in C# using OpenGL and GLSL. as a test I render a 2D grid of quads using geometry shader with : layout (lines_adjacency) in; layout (triangle_strip, max_vertices =...
L Chougrani's user avatar
0 votes
0 answers
31 views

Named Uniform Block binding point assignment

If I specify binding explicitly within a shader: layout (binding=0) uniform NamedUniformBlock { ... }; ...do I still need to call glUniformBlockBinding()?
nulladdr's user avatar
  • 751
-3 votes
0 answers
32 views

How do I read preloaded files with emscripten? [closed]

I'm struggling to read files that are preloaded to emscripten. I get shaders compiled as long as I have a string, but reading from the virtual filesystem results in gibberish. Here is my main function:...
Macintyre Sunde's user avatar
1 vote
1 answer
45 views

How to avoid upper limit of repetitions in loops when using float variables as iterators in GLSL?

I'm making a simple fragment shader visualizer tool with OpenGL to easily display and work with GLSL fragment shaders. I'm making it in C using GLFW. Of course, my reference is shadertoy which I think ...
LogicEu's user avatar
  • 11
-1 votes
0 answers
17 views

Trying to fetch my glsl files in my js file

Im trying to fetch my glsl files in my js file but when I run the html file locally, I get a TypeError: failed to fetch. Any possible solution? all my files are in the same folder so im unsure why I ...
Cris's user avatar
  • 1
-1 votes
0 answers
32 views

How can I use SSBO data per object instance? (Vulkan/GLSL)

I am working on a particle/n-body system compute shader in Vulkan and my SSBO stores the primitive data for each particle object and draws a point primitive using the vkCmdDraw call, where the vertex ...
HeyoItsMateo's user avatar
-1 votes
0 answers
31 views

Shaders in FreeGLUT not working as intended

I am currently trying to integrate shaders into my first renderer based on FreeGLUT. Below you can see my current state, the goal is to apply the shading (only) to the tshirt. The shaders are kept ...
Raijen's user avatar
  • 46
0 votes
0 answers
42 views

WebGL2 getUniformLocation returns null on Android

I'm pretty stumped on this one. I have a fragment shader with a handful of uniforms. I'm fetching the location of the uniforms like this: this.gl.useProgram(this.program) // Get uniform ...
user3722952's user avatar
-1 votes
0 answers
50 views

Why do these simplified OpenGL vertex/fragment shaders crash on some hardware? [closed]

I'm developing an OpenGL application and I wanted to provide a simplified version of a working vertex and fragment shader pair. The original version works on all kinds of hardware it was tried with. ...
farnadi.kelemen's user avatar
0 votes
0 answers
22 views

noise function not generating the expected output [closed]

I am trying to generate a value noise with a noise function in glsl and i am getting wierd output. This is my shadertoy i am working on https://www.shadertoy.com/view/mdtyD2 and this is my glsl code: /...
Pravin Poudel's user avatar
0 votes
1 answer
33 views

Why are my billboarded quads being rendered this way?

So I am instancing a quad a bunch of times in an area in love2d, which seems to be going fine, but when I add some shader code to billboard them they render at an odd spot and look like they are all ...
James Washington's user avatar
0 votes
0 answers
33 views

Send large array from VERTEX shader to FRAGMENT shader

I have implemented nice normal mapping in my simulator. It can handle multiple omni lights, which i upload as an UBO to the GPU. I read here https://learnopengl.com/Advanced-Lighting/Normal-Mapping ...
Avi's user avatar
  • 1,075
0 votes
1 answer
20 views

In GLSL why is it only storage buffers and not uniform buffers that can have an empty array declaration?

I have the following code: struct GridInfo {}; struct TextureGridResult {}; layout (set = 1, binding = 1) readonly uniform GridTextureArray { GridInfo texture_grid_info[256]; }grid_texture_array[...
Zebrafish's user avatar
  • 11.9k
0 votes
1 answer
48 views

Unexpected pixel selected in fragment shader

I have a simple shader drawing a rectangle in which I want to change color in the fragment shader depending on the fragment coordinate. A basic implementation binding normalized UVs to vertices works, ...
Kiwi's user avatar
  • 2,716
0 votes
1 answer
38 views

Tangent seams in Vulkan using GLSL and C++

I am writing a small Vulkan toy renderer using tinygltf to load my models. For the past two weeks I've been trying to implement normal mapping into the renderer, but I've been running into issues. I ...
Jef Belmans's user avatar
-1 votes
0 answers
69 views

Loaded and compiled fragment shader is not being displayed

I'm learning OpenGL with SDL2. As a first step I'm trying to load and display a fragment shader using OpenGL (glew) and SDL2. My plan is to have the code purely in C (as far as possible). The main.c ...
icoon's user avatar
  • 1
0 votes
0 answers
26 views

Guidance on how to create a distorted shader effect?

I'm new to shaders specifically GLSL but am familar with concepts in generative art used in touch designer and javascript. I'm trying to create a shader material in react3 fiber, I want to create a ...
Laiqa Mohid's user avatar
-4 votes
1 answer
65 views

OpenGL scene fails to render?

I need to create a lamp with a pole and stand in OpenGL. I need to use at least 2 primitive shapes and different color to each vertex of the object. For some reason nothing is rendering. What is wrong ...
NTB_Kilmonger's user avatar
-1 votes
1 answer
23 views

Buffer read-back working depends on order of bind/map with DSA

I am trying to perform read-back of SSBO data in OpenGL. For this I persistenly map the SSBO, but the following piece of code does not actually read back the written data from the example compute ...
IGarFieldI's user avatar
-2 votes
0 answers
43 views

Opentk Lighting Shader not using rotation

public void set_uniform(ModelMatrix modelMatrix, Matrix4 projectionMatrix, Matrix4 viewMatrix) { int matrixloc = GL.GetUniformLocation(shader_program, &...
Batu Erdil's user avatar
0 votes
0 answers
24 views

GLSL Fresnel effect makes half of my sphere white

Here in app using r3f, in my sphere object I use the fresnel effect in my vertex shader, but the problem is that when the sphere is rotated the other side is pure white like in the example bellow ↓ ...
Dronius's user avatar
  • 57
0 votes
1 answer
46 views

Video cards and hardware-accelerated operations on double

Good day to all! I am trying to use computational shaders (GLSL) to speed up some geodetic calculations. I recently got an experience showing that FP32 (float) accuracy is not enough. In trying to ...
Roman Zuev's user avatar
0 votes
1 answer
13 views

value noise is not correlated

I am learning noise in glsl and this is the code that i have written as first stage on making gradient noise. https://www.shadertoy.com/view/dljBzt this is a link to shadertoy as well code: float ...
Pravin Poudel's user avatar
0 votes
0 answers
27 views

OpenGL - Stencil, Requesting for information and pointer

Is it possible to make a Cube notch another cube without notching its neighbour via id? See small 2D sketch below. I think I need to make a custom stencil shader GLSL (set 0 and 1 myself, is it ...
Sebastien Lachapelle's user avatar
1 vote
1 answer
19 views

Loading glsl shaders in react/typescript with craco

I am trying to use GLSL files in my react/typescript project, but as far as I understand this requires modification to the webpack config. To do this I could eject my application or use a third-party ...
Dronius's user avatar
  • 57
0 votes
0 answers
27 views

How to pass time to a shader in android using openGL es

I'm quite new to openGL and have a very specific requirement to create rain effect in my android app. I found a tutorial of three.js to create such graphics but it is passing a time variable which ...
Areeb Lone's user avatar
0 votes
1 answer
16 views

problems with refreshing GLSL canvas in React app

I have implemented a Glsl canvas background in a React Comp and it refuses to refresh on reload (hacky i know) i've tried both the commented out stuff and the other version..... i am basically having ...
Colette Smith's user avatar
-1 votes
1 answer
56 views

OpenGL texture mixup

So I have a texture class in opengl that basically get's a buffer and renders a 2D texture on the screen. On itself, it works perfectly fine and allows me to render as many textures as I want on the ...
Turgut's user avatar
  • 649
0 votes
1 answer
14 views

GLES sampler2d will only draw what is in the first texture slot

Currently using Android Studio, writing in Java and GLES3 a mobile app. I am trying to get multiple textures in my program and it seems that my shader will only draw what is in GL_TEXTURE0, regardless ...
AdrianHEY's user avatar
  • 155
1 vote
1 answer
21 views

How to know which ShaderChunk to replace when extending three.js built in materials with custom shaders?

When extending three.js materials with my own custom glsl shaders using the .onBeforeCompile() method we replace certain parts of the existing material shader code, for example: myMaterial....
Dronius's user avatar
  • 57
1 vote
1 answer
28 views

Updating a GLSL uniform variable in an animation within three.js with typescript not working

I have a three js, typescript application, within it I use my own custom GLSL shaders. Throught designing the shaders I used the THREE.ShaderMaterial() class but now I want to refactor my code so that ...
Dronius's user avatar
  • 57
0 votes
1 answer
23 views

mixing of noise from four corner glsl

I am studying noise from the bookofshaders and in 2d noise this is the code in the book or website. #ifdef GL_ES precision mediump float; #endif uniform vec2 u_resolution; uniform vec2 u_mouse; ...
Pravin Poudel's user avatar
1 vote
1 answer
38 views

OpenGL - GLSL Geometry Shader - gl_Position to gl_FragCoord

How can I convert gl_Position to gl_FragCoord in order to check if the gl_FragCoord is between 2 points? See what I have done so far below "it glitch, there is a bit of red". I think I am ...
Sebastien Lachapelle's user avatar
0 votes
1 answer
40 views

How are separated sampled images and samplers used in Vulkan with GLSL?

I just finished writing up the code for my texture and sampler objects, but now I am stumped on how to implement the separated descriptors into GLSL. Accessing a combined image sampler in descriptor ...
ModernEraCaveman's user avatar
0 votes
1 answer
54 views

Fragment shader code from file doesn't work like hardcoded

At the shader loading stage I decided to load sources from a file instead of a hardcoded. Everything is loaded successfully, there are no errors at the shader assembly stage, but the color is not ...
Val Zubko's user avatar
0 votes
2 answers
56 views

React-three-fiber Gaussian blur

I am trying to add Gaussian blur to a scene. I am using this GLSL shader: uniform sampler2D tDiffuse; uniform int uKernel; uniform float uSigma; uniform vec2 uDirection; uniform float uStrength; ...
Orkun Yigit Cengiz's user avatar
1 vote
0 answers
60 views

Error finding GLSLang library using CMake

I recently downloaded and built the GLSLang libary for use in my project, but when I try to find it using find_package(glslang REQUIRED), I get an error about missing target SPIRV-Tools-opt. I looked ...
xarxarx's user avatar
  • 31
1 vote
0 answers
34 views

GLSL Fragment Shader pixel color issue

I have a texture on a plane, I then modified pixels to get this image After I got this image I want to select eyes and color them red, the way I went about is to select the pixels in specific area (...
Jeekim's user avatar
  • 553
-1 votes
0 answers
46 views

How is it that almost all fragments of my scene have a z-value between 0.99 and 1? [duplicate]

I'm currently implementing shadow maps in my OpenGL engine. I've created an FBO to store it, and then I perform an initial rendering pass into this buffer before rendering my scene with my usual ...
Mig Tao's user avatar
0 votes
1 answer
37 views

How to make transparent elements render elements behind them in WebGL?

I have a 3-D mesh composed of cubes in WebGL. Each cube is made of triangle primitives. Some of the cubes need to be transparent, allowing cubes in the background to show through. My current solution ...
giveearholdtongue's user avatar
-1 votes
0 answers
35 views

Vulkan: sampling stencil value in fragment shader

Unfortunately I can't find any guidelines to set up depth/stencil texture correctly to be able get its both depth and stencil values in fragment shader. I know that OpenGL requires extension described ...
MoonDweller's user avatar
2 votes
1 answer
38 views

Using GLSL, how to create a perspective bending like effect

I'm trying to make a perspective bending GLSL shader similar to this. Original: Perspective Bending: void mainImage( out vec4 fragColor, in vec2 fragCoord ){ vec2 uv = fragCoord.xy/iResolution....
Mouaad Abdelghafour AITALI's user avatar
0 votes
0 answers
28 views

Simple occlusion culling algorithm is not culling out any of the objects

I have some issues with implementing occlusion culling. For me, it doesn't seem to work as intended. Basically, on images I have my view frustum and object right in front of the camera. Unfortunately, ...
Arheus's user avatar
  • 21
0 votes
0 answers
22 views

Why are my JOGL lighting shaders not working?

I am currently working with lighting shaders in JOGL, and they are not working very well. I dont really know what i did wrong, but the light position is not applying (i think) and overall the light is ...
IAmSoCool's user avatar
0 votes
1 answer
30 views

not able to understand the fract function graph

This graph: ...is of: y = fract(sin(x)*1.0) I was expecting the graph like this: am i missing something? I dont know how i can plot this graph in glsl so don't know how to check so i thought i can ...
Pravin Poudel's user avatar
1 vote
1 answer
31 views

What is the equation for bilinear filtering between 2 mip levels based on texture coordinate derivatives

Tagging as OpenGL since the question should be OpenGL/WebGL agnostic I'm trying to implement shader based texture filtering. I had a previous question and an answer that helped me fix a bug in ...
gman's user avatar
  • 101k
1 vote
1 answer
195 views

Implementing Pencil Brush Texture in OpenGL for Drawing Application

I am working on a drawing application in OpenGL and would like to simulate a pencil brush similar to what applications like Krita and Procreate use. However, I'm facing challenges with getting the ...
Avinash kumawat's user avatar
2 votes
1 answer
60 views

Compute mip level selection from texcoord varying

Marking as OpenGL even those the example in the question is WebGL because OpenGL domain experts should be able to answer this question. There's an OpenGL repo here I'm trying to compute texture mip ...
gman's user avatar
  • 101k
0 votes
0 answers
29 views

Why isn't my time uniform updating in my actual glsl code?

I'm creating an editor for coding shaders in the browser, and I'd like to include a uniform that updates every frame so that I can do animations. I have an array of "Uniform" objects that I ...
Recaptchow's user avatar
1 vote
1 answer
40 views

Why empty function changes the result?

I've got this glsl vertex shader: layout(location = 0) in vec4 a_position; layout(location = 1) in vec4 a_color; layout(location = 0) out vec4 v_color; struct VertexMaterial { vec4 color; }; ...
Edziju's user avatar
  • 391

1
2 3 4 5
161