What is Vector in glfw

Feb 8, 2016 at 5:34am
1
2
3
4
5
layout(location=0)in       vec3 position
void main()
{
  gl_Position=vec4(position.x,position.y.position.z,1.0);
}


What are these "vec3","vec4" in glfw?
Why they have been used here?
Feb 8, 2016 at 10:25am
They are mathematical vectors. If you've ever studied linear algebra you'd know that They are one of the most important things in 3D programming.

If you want someone to explain vector multiplication and scalar, and pretty much how they are used within the 3D World - https://www.youtube.com/playlist?list=PLRwVmtr-pp04XomGtm-abzb-2M1xszjFx

Bunch of vector videos in that playlist.

Then there is khan academy with mathematical vectors - https://www.youtube.com/playlist?list=PLFD0EB975BA0CC1E0

Or you can just google linear algebra vectors and read about them =)

Edit:

Note that openGL does not have vec3, vec4 like in your code. You will have to use a library for that, the best one in my opinion, and the most used one is GLM.
Last edited on Feb 8, 2016 at 10:39am
Feb 8, 2016 at 10:34am
How is that possible! I have copied it from the source code of my tutorial
Feb 8, 2016 at 10:39am
That's because your code is GLSL. It's shaders, right? In GLSL (the code you write for shaders) vec3, vec4, and matrices exist there, but not in the CPU part of openGL. Then you would need a library

http://learnopengl.com has a page where it explains everything about vectors and matrices aswell (matrices are even more important than vectors)

http://learnopengl.com/#!Getting-started/Transformations

Edit: Also, you should stop posting in the windows section of this forum, this has nothing to do with window programming.
Last edited on Feb 8, 2016 at 10:43am
Feb 12, 2016 at 12:58pm
Which section would be more apropriate for these questions? #TarikNeaj
Feb 12, 2016 at 1:04pm
General c++ Programming
Topic archived. No new replies allowed.