1.OpenGL does not include windowing system. I knew that. This is reason why OpenGL is cross platform. Window, Linux, etc, etc each have their own windowing system. There are also cross-platform ones like Glut and QT (which is what I chose to build on).
2.Qt encapsulates different version of OpenGL function calls into different classes. You can specify what version of OpenGL to try to use. I put all my OpenGL function calls into a "Viewer" class that inherits from QOpenGLFunctions_4_0_Core, which gives me all the core OpenGl 4.0 function calls. So, this is different from what I understand GLEW does, which finds all the available OpenGL function calls. Qt also has OpenGl encapsulating functions like
1. QOpenGLShaderProgram encapsulates the loading, binding of GLSL shaders, glEnableVertexAttribArray and glVertexAttribPointer
2. QOpenGLBuffer encapsulates glGenBuffers,glBindBuffer, glBufferData
3. QOpenGLTexture encapsulates glTexImage2D, glBindTexture
4.QOpenGLVertexArrayObject replaces glGenVertexArrays, glBindVertexArray
But the more I learn OpenGL from guides (like OpenGL programming guide 4.3 ) and tutorials the more annoying it is to translate in my head the gl* functions to Qt object calls. So, I ended up ignoring these.
One good thing about Qt, is that I don't need to use the Qt encapsulating class objects if I don't want to. However, because of the added layer of complexity by Qt, it might be the reason for the inconsistencies I found.
3. OpenGL also does not support texture import which again Qt supports. I used Qt's own QImage class that can read image file and convert it to RGBAA required for glTexStorage2D.
4. All the OpenGL tutorial demos I've seen passed vectors and positions attributes from vertex to fragment shader with the default varying qualifier in world space, but gl_position in perspective space. In my mind, the normal, viewer, light direction vectors needs to be also transformed to perspective space. I asked the same question this on stackoverflow, and digged digger. I found a scratchapixel article explaining how to perspective-correct interpolate depth and other attributes in C++ and that OpenGl and DirectX already had implemented it. Thus, in my engine, all I need to get perspective-correct interpolation of normals, vertex coordinates, etc is to pass the attribute in view coordinate space. OpenGl will automatically change them into perspective space. However, I have to manually do the perspective divide.