Isaac Woods
Isaac Woods

Reputation: 1163

Trivial shader with "not enough data provided for construction constructor"

I have a fairly trivial vertex shader:

#version 330 core

layout (location = 0) in vec2 position;
layout (location = 1) in vec2 uvCoord;

uniform mat4 view;
uniform mat4 projection;

out vec2 _uvCoord;

void main()
{
  gl_Position = projection * view * vec4(position, 1.0);
  _uvCoord = uvCoord;
}

Which is giving the error:

ERROR: 0:13: error(#174) Not enough data provided for construction constructor
ERROR: error(#273) 1 compilation errors.  No code generated

I have tried googling for what causes this sort of error, without avail. Failing that, I have looked through the shader code carefully, but as far as I can see there are no problems with it.

What causes this sort of error, and how can I fix this shader?

Upvotes: 0

Views: 5506

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473537

vec4(position, 1.0)

vec4 construction requires 4 values. position, as a vec2 only provides 2 values, and the float at the end only provides one, so there's one not provided. Hence the error.

Upvotes: 9

Related Questions