default values for shader position attribute components?

Hello,

I’m looking at some code from a few years ago and trying to remember how it worked. My vertex shader has a position input specified like this:

in vec4 position;

But when I am setting up my vertex buffer objects, it looks like I am only providing vertices with 2 components, x and y. That’s possible to do, right? Have 4 components for position in the shader but only supply 2 in the input buffer? Or not? The code seems to work fine.

In that case, what is the value of the z and w components in the shader, is there a default? I’m porting the code to Metal, and using the value 1 for both z and w is what makes it work. But I am wondering if that is the default value in OpenGL or if there’s something else in the code that I’ve missed.

Thanks!

Ah nevermind, I found the documentation where it specifies that missing component values are taken from the vector (0,0,0,1). I suspect the reason my my z value needs to be 1 in the new code is due to the difference in Metal’s normalized device coordinates, or the way I have my projection matrices set up.