The Khronos Group - a non-profit industry consortium to develop, publish and promote open standard, royalty-free media authoring and acceleration standards for desktop and handheld devices, combined with conformance qualification programs for platform and device interoperability.

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: Positional data in pixel shader

You can take uniform variable in fragment shader and assign that to gl_Fragcolor. Now in your draw function loop, change your local variable as per your color requirement and assign value of this local variable to uniform variable.

Re: Positional data in pixel shader

The interpolated positional vertex data is not available in the pixel shader for OpenGL ES 2.0, as you discovered.

One solution is to use the texture coordinates instead because they are available in the pixel/fragment shader in interpolated form. This is what is normally used to sample textures, such as gsvTexCoord in this example:

gl_FragColor = texture2D(gsuTexture, gsvTexCoord);

The only real difference is that gsvTexCoord has a limited range of only 0.0 to 1.0.