0

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?

1 Answer 1

3

To pass values between shader stages you must use so called varyings; the keywords are varying or out and in – there was a keyword change between GLSL 1.20 to 1.40 but the basic gist that you need special type qualifiers. See http://www.opengl.org/wiki/GLSL_Type_Qualifiers#Shader_stage_inputs_and_outputs for the details.

Sign up to request clarification or add additional context in comments.

2 Comments

ofc in vector shader I use out vec3 N and in fs in vec3 N but it doesnt help
@mjanisz1: You said your code was vec3 N = .... In this code, N is a local variable. You need to declare shader stage inputs/outputs globally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.