Creating applications with GLFW questions


I was learning SDL, but discover GLFW and like the simplicity, nice documentation and can be linked static.

My questions are

  1. Can I create application with GLFW?
    I am interest in VST and VSTi and other audio applications or my own experimentations. GLFW looks good and simple with NanoVG as GUI.

  2. It is posible create window inside window and with drag outide window? - something like VisualStudio 2013 or more where I can move window and dock it or undock it in main window.

  3. I am new with OpenGL. It is good learn new OpenGL and use only OpenGL2 ? Or it is better learn only OpenGL2. I don’t need complex functions like physical lightning or shadows because I want create applciation without 3d (or only very simple 3d) and need run everywhere where is OpenGL support.

  1. Yes.

  2. GLFW doesn’t provide creation of child windows, but if you’re rendering your UI with NanoVG then that can include rendering child windows within the single OS window.

  3. OpenGL 2.x is very old at this point and only suitable if you are planning to support very old machines. OpenGL 3.3 may be a good and compatible baseline. Even integrated GPUs support OpenGL 4.x.

If you are just planning to render a simple UI then you can use whatever version, but modern OpenGL is closer to what the hardware is actually like, will provide better performance and better habits for future projects, and there are a lot of good resources for learning it.

Thanks for answers.

If I learn OpenGL 3.3, may I still use OpenGL 2? What I read on internet, i understand it with this way: when version 3 is used, it will be compatibile with version 2 or less until some functions from version 3 will be used. I am right?

I’m not sure I understand the question. If you use features from a given version of OpenGL then your program will require at least that version to run.

It is maybe partial answer. I mean, if I learn OpenGL 3 and write some basic where it show simple lines, load textures etc… what can be renderered with OpenGL 2, can OpenGL 2 render it (written in OpenGL3)?
Now I understand it that way: using OpenGL 3 work only with OpenGL 3 and more, even if I draw simple triangle with it. But single triangle can render OpenGL 1 to recent OpenGL.
I remind, I never use OpenGL I am completly new about it, maybe this questions are not clever, but I don’t know how to ask.

Rendering triangle of course can be done with OpenGL1, 2, 3 or any other minor version. The thing that changes between versions is they way how you use API to submit geometry or anything else you want to do with GL pipeline.

For example, with GL1 you could do glBegin(…); glVertex(…); …; glEnd();
Then in some minor GL1 version you could use client-side arrays with glVertexPointer. Then later you could use VBO from GPU memory.
With GL3 and up you are supposed to use only glVertexAttribPointer from GPU memory. And no more glBegin/glEnd calls.

Another example - shaders. With GL3 and up you are supposed to use GLSL to perform vertex transformation and fragment shading. If you use it, then your code won’t work on anything <GL2 (or without some specific extensions). Although it would be pretty hard nowadays to find system that doesn’t support at least GL2 or even GL3.

Of course you can still write code even with GL4.5 context that doesn’t use GLSL to render triangle, and submits all geometry with glBegin/glEnd. But at that point you are really not writing GL4.5 code. You are writing GL1 code.