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

GLSL 1.5 can't get color input

I just want to do a simple Gouraud Shading with some different colors on my objects. Basically my problem is, that I can't get the color values into the shaders, it just renders black. If I define a vector in the shader as a color for the whole…
0
votes
0 answers

JOGL - uniform int variable and for loop causes shader linking error

I've got a shader which blends multiple textures. I send number of textures as uniform int variable. When I iterate over textures (using this variable in for condition), shader linking fails, but when I place exact number of textures, everything…
0
votes
1 answer

OpenGL ES 2.0 SL writing out from fragment shader to texture

Hopefully this is a really simple question. How to write out to a texture attached to framebuffer from within a fragment shader. I assume it is just gl_FragColor, am I suppose to define/use a different variable, like gl_Data[0]? Frag Shader: …
HPP
  • 1,074
  • 1
  • 13
  • 28
0
votes
0 answers

Benching Intel 4000, Radeon 7670m and 4850

I am trying to benchmark GPUs. I have a Radeon 7670m (480 x 600 MHz), Intel 4000 (16? x 1100 MHz) and Radeon 4850 (800 x 625 MHz). I throw in a 4096 x 4096 Rg32f-texture and receive a Red-texture. Each pixel takes 400 - 800 ns. The 7670m is around…
0
votes
2 answers

What are the vertex and fractal shader instruction count limits in WebGL for Chrome?

How many instructions can a vertex and fractal shader each have in WebGL in Chrome, without taking rendering time per frame into account? from: https://groups.google.com/forum/#!topic/angleproject/5Z3EiyqfbQY So the only way to know an instruction…
Adrian Seeley
  • 2,262
  • 2
  • 29
  • 37
0
votes
1 answer

How many arithmetic instructions are too many?

Currently I am trying to make some shader textures for a game and I am using perlin noise to do so, each time I get a noise value, it adds about 730 instructions to the shader, how many instructions should i aim for? What video cards would support…
Guedez
  • 189
  • 3
  • 14
0
votes
1 answer

Specifing the color for webGL cube in fragment shader

I want to draw a single colour cube in WebGL and I want to specify the color with in the fragment shader. I know that I can do that when I drawing a square. To eloborate my question can I avoid using the color buffer in the way that it is mention in…
Tharanga
  • 2,007
  • 4
  • 32
  • 50
0
votes
1 answer

Pass 1d texture into fragment shader - all zeroes?

I'm trying to pass an array of ints into the fragment shader by using a 1D texture. Although the code compiles and runs, when I look at the texture values in the shader, they are all zero! This is the C++ code I have after following a number of…
nbubis
  • 2,304
  • 5
  • 31
  • 46
0
votes
1 answer

How to get time as an input to the fragment shader?

I am using the GPUImage framework. And I am writing my own fragment shader. I need to get time data as an input into the fragment shader. What is the proper way to get time data as an input to the fragment shader? Thanks.
MobileDev
  • 3,750
  • 4
  • 32
  • 35
0
votes
1 answer

cg: Vertex output struct corrupted by different member order? Profile violation or cg bug?

I've been tinkering with cg shaders for Retroarch, and I've encountered what appears to be a strange bug in the Cg Toolkit's compiler or code generator...or something. Consider the three-pass shader found here which simulates a CRT TV:…
Mike S
  • 531
  • 4
  • 14
0
votes
1 answer

Bump mapping with GLSL

I'm trying to implement bump mapping but I don't know where is the problem, the shaders seems to be ok. I'm pretty sure the normals, tangents and bitangets are well computed and the problem is in the shader but if anyone wants to look other parts of…
Tolokobcn
  • 21
  • 5
0
votes
2 answers

Accurately passing the player's relative position into AGAL

I'm trying to develop a fragment shader that fades to 0 where the face normals are perpendicular to the direction of the player 'camera'. (This is for spherical planet atmospheres; I want them to fade at their outer extent). I have the game set up…
moosefetcher
  • 1,841
  • 2
  • 23
  • 39
0
votes
0 answers

Looping vs unrolling in fragment shader in iOS

One of my fragment shaders emulates some of the basic OpenGL ES 1.1 multi-texturing features. As part of that, I have the following GLSL function declared: void applyTexture(int tuIdx) { lowp vec4 texColor = texture2D(s_cc3Textures[tuIdx],…
Bill Hollings
  • 2,344
  • 17
  • 25
0
votes
1 answer

Ashikhmin-Shirley model implementation: ugly result

I am trying to implement the Ashikhmin-Shirley model using these formulas: This is the GLSL 1.2 fragment shader code: uniform vec4 materialAmbient, materialDiffuse, materialSpecular; uniform float materialShininess; uniform vec4 lightAmbient,…
Ramy Al Zuhouri
  • 21,580
  • 26
  • 105
  • 187
0
votes
1 answer

OpenGL & GLSL: Greyscale texture not showing

I'm trying to show a greyscale texture on the screen. I create my texture via glGenTextures(1, &heightMap); glBindTexture(GL_TEXTURE_2D, heightMap); glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, 512, 512, 0, GL_RED, GL_FLOAT, colorData); colorData is a…
user2623674
  • 83
  • 1
  • 6