Questions tagged [fragment-shader]

A GPU program used in rendering. It is executed for each sample taken from a rasterized primitive. The output of this process is a number of values and a floating-point depth.

Resources

1506 questions
0
votes
0 answers

Updating Attribute variables in Vertex Shader(glVertexAttrib3f) working as glVertex

I am having trouble using Attribute variables for getting a value into vertex shader. I want to provide the geometry shader with one of the points from the previous primitive(line) for some calculation. I am providing this point using a vec3…
AdityaG
  • 428
  • 1
  • 3
  • 17
0
votes
0 answers

Does the size of a texture image impact the performance of texture fetching?

Using OpenGL ES 2.0, does the size of the texture impact how long it takes to fetch from a texture? I would think that it should be almost constant time to fetch a color.
Joey Carson
  • 2,973
  • 7
  • 36
  • 60
0
votes
2 answers

Bad openGL version for GLSL shaders

I just want to make an OpenGL program using GLSL shader. But when I'm compiling it I have the following error message : Version number not supported by GL2. Here's my vertex shader code : #version 400 in vec3 Color; out vec4 FragColor; void main()…
user1364743
  • 5,283
  • 6
  • 51
  • 90
0
votes
1 answer

can I use shadermaterial on particlesystem?

what am trying to accomplish is to to put a different pixel data as the material of each particle, this is my train of thought: set a canvas as texture of a PlaneGeometry, get pixel chunks of data from PlaneGeometry through fragment shader and put…
Memo Lestas
  • 393
  • 1
  • 4
  • 13
0
votes
1 answer

Starling filter : invert alpha

I try to make a shader for Starling that will invert alpha (a kind of mask) of a Starling sprite : var fragmentProgramCode:String = // Get texture "tex ft1, v0, fs0 <2d,linear,nomip>" + "\n" + // make 1 - pixel alpha "sub ft1.w, fc0, ft1.w" + "\n"…
0
votes
0 answers

Android YUV-RGB conversion in OpenGL ES 2.0 fragment shader

I'm trying to locate/figure out how to color covert a YUV texture (for instance YUV420P) to RGB in OpenGL ES 2.0 fragment shader code on android. I have found various pointers/tips but haven't been able to convert it correctly. Does anyone know if…
0
votes
1 answer

WebGL texture2DLod alternative?

I'm writing texture atlas on the fragment shader and I really need to use texture2DLod in order to render the textures correctly in different mip levels. I just found out that WebGL only supports texture2DLod on the vertex shader. Is there some way…
Jón Trausti Arason
  • 4,548
  • 1
  • 39
  • 46
0
votes
0 answers

GLSL implicit int to float error yielded at "float to float"…?

The following line in my fragment-shader… gl_FragColor.r = curPosition.x; raises warning C7011: implicit cast from "int" to "float" but curPosition is defined as vec3 (so it is a float) and gl_FragColor.r is … well … a float. so… what's the problem?
rhavin
  • 1,512
  • 1
  • 12
  • 33
0
votes
1 answer

Normalize function in webGL not working (THREE.js)

I am currently working on creating a shader in THREE.JS which will act like the normal shader, but using a color as the input to define how it is shaded. Below is the Code that is causing the problem, and after that is a longer explanation of why I…
Cabbibo
  • 1,371
  • 3
  • 17
  • 30
0
votes
1 answer

openGL using glVertexAttribPointer

So I created a quad using glBegin(GL_QUADS) and then drawing vertices and now I want to pass into my shader an array of texture coordinates so that I can apply a texture to my quad. So I'm having some trouble getting the syntax right. First I made…
user1782677
  • 1,963
  • 5
  • 26
  • 48
0
votes
0 answers

GLSLES Losing 5-6ms using uniform float instead of e.g. 0.5

I have this fragment shader. On some "sprites" i want a different "saturation" of the texture. At the moment i only set it once but later i would set it each draw depending on the sprite beeing drawn. As noted in the code if i just write * 0.5 i…
0
votes
2 answers

OpenGL shader - overlaping multiple textures

I am not able to find a pattern to draw textures one over other. I need to make result fragment color like: tex1 + (1-tex1alpha)*tex2 + (1-tex1alpha-tex2alpha)*tex3 Not to mix textures , but to place one over other like layers in image editor.
user1993006
  • 79
  • 1
  • 1
  • 4
0
votes
1 answer

Fragment shader inexplicable bahaviour

I have written a C++ program where I draw a teapot and apply lighting. It is itself simple, but I also use shaders. Simple I'm new with GLSL I just tried a simple fragment shader, but the screen output is inexplicable. In this file I initialize…
Ramy Al Zuhouri
  • 21,580
  • 26
  • 105
  • 187
0
votes
1 answer

OpenGLSL error while compiling fragment shader using UBOs

I am trying to get UBOs working, however I get a compilation error in the fragment shader: ERROR 0:5:"(": synrax error. Fragment Shader: layout(std140) uniform Colors { vec3 SCol; vec3 WCol; float DCool; float…
user1128265
  • 2,891
  • 10
  • 29
  • 34
0
votes
1 answer

converting GLSL #130 segment to #330

I have the following piece of shader code that works perfectly with GLSL #130, but I would like to convert it to code that works with version #330 (as somehow the #130 version doesn't work on my Ubuntu machine with a Geforce 210; the shader does…
Daniel Schreij
  • 773
  • 1
  • 10
  • 26