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

How does sampler2DArrayShadow in glsl works

I am not able understand how to use sampler2DAprrayShadows and how it works. Got some part of it that we need to use depth texture values (GL_DEPTH_COMPONENT) to get the compare result with ref depth. But then how to use the return float value to…
user1896853
  • 107
  • 1
  • 9
0
votes
1 answer

CG shader threshold function

Is there some builtin fragment function in CG that allows me to compute the following without conditionals? y = x>bias?1.0f:0.0f;
matthias_buehlmann
  • 4,641
  • 6
  • 34
  • 76
0
votes
1 answer

In AGAL, when using the 'kil' opcode, does the DepthTest skip that pixel?

Let's say I was building a game, and had some tilemaps to create the world in several layers. The view would be orthographic, basically just a top-down view of the world. I'm thinking of using Depth-Test to compare which sprites gets drawn from top…
chamberlainpi
  • 4,854
  • 8
  • 32
  • 63
0
votes
1 answer

What is the performance cost and downside of a 2-channel normal map?

What I am doing is using normal maps to light 2D sprites. Originally I was going to use a bump/height map in the images red channel and use the other two channels to store other information. What I thought was that since I know that any normal on…
cmann
  • 1,920
  • 4
  • 21
  • 33
0
votes
1 answer

Pass from vertex shader to fragment shader

I'm trying to send some vectors from vertex shader to fragment shader: ex: vec3 N = (view*model*vNormal).xyz and when trying to reach it in fragment shader: Link errorERROR: Input of fragment shader 'N' not written by vertex shader any ideas?
mjanisz1
  • 1,478
  • 3
  • 17
  • 43
0
votes
2 answers

Creating a 2D grid using openGL and vertex and fragment shaders

OK so i have a really big square (grid) that I have made up using triangles, then applied a heightmap to bump it. What im trying to do now is get grid lines on it. I have figured out a way to do this but this results in 33 if statements in the…
Mike Tarrant
  • 291
  • 2
  • 7
  • 19
0
votes
1 answer

OpenGL Odd Row Fragment Shader Error: Not drawing

I'm writing an application that renders every frame of in interleaved stereoscopic 3d. To make this happen, I am writing two fragment shaders: one to render the left eye's frame's odd rows, and one to render the even rows of pixels of the right…
a10y
  • 309
  • 6
  • 11
0
votes
0 answers

Uniform float in fragment shader. Tablet PC

I am using JNI and NDK to build an OpenGL project, everything is ok on my phone (galaxy nexus), but i've tried to start this app on several tablet pcs (huawei and acer) and find a strange behaviour: in my fragment shader there is a value: …
dilix
  • 3,761
  • 3
  • 31
  • 55
0
votes
1 answer

OpenGL Shader Program Weird Result

I have created a basic shader program to brush up on my openGL GLSL. on the cpu side i have properly created my shader program .vp and .fp linked properly and error checked my result when i render is always a black Triangle Right before i link my…
Franky Rivera
  • 553
  • 8
  • 20
0
votes
0 answers

Three.js and GLSL - Kaleidoscope shader

I'm starting and experimenting with GLSL and WebGL. Using Three.js r52. I have a simple plane geom mesh with a Shader material. I'm already passing a texture as uniform property, and I was able to manipulate it in different ways. But, when I try to…
0
votes
0 answers

WebGL frame by frame animation from multiple textures

I am currently working on a prototype which aims to create a short interactive film made from a sequence of fast interchanging images. On each frame we plan to apply a fish-eye post-processing effect and leveraging WebGL to offload this computation…
Gixo
  • 389
  • 2
  • 4
0
votes
3 answers

Any OpengGL Shader Spelling Checker?

I haven't found a tool for checking text spelling on OnpenGL shader for eclipse or another. Dealing with spelling errors on text based shaders like: protected String vertexShaderCode = // This matrix member variable provides a hook to…
Enriquillo
  • 37
  • 1
  • 12
0
votes
1 answer

Cocos2d: can't get a fragment shader to draw only non transparent pixels of an image

I am trying to play around with this raywenderlich tutorial. I am interested in the CSEGrass example (button of page). I did try to run the shader on a small image with an alpha channel that is added to the scene after a blue background. Here is…
mm24
  • 9,280
  • 12
  • 75
  • 170
0
votes
2 answers

improve Opengl 2.0 fragment shader

How can I improve this fragment shader: #ifdef GL_ES precision mediump float; #endif varying vec4 v_fragmentColor; varying vec2 v_texCoord; uniform sampler2D u_texture; uniform vec2 blurSize; uniform vec4 substract; void main() { vec4…
andrés
  • 412
  • 6
  • 14
0
votes
1 answer

Store modified pixel back into texture memory

Hi i am trying to implement a image re-targeting algorithm using openGL ES2.0. This algorithm first uses a Sobel filter and then a image difference to check edges and then motion respectively. It then use these values to create a matrix which will…