I am playing on nana library for gui.
I also have to use opengl, But there is one example for opengl, which is for windows. Link
I am using ubuntu linux. above example call reinterpret_cast<HWND>(fm.native_handle());
I finally have found it.
The root window attaches to the OS/Windowing system native window, native_handle returns the handle of native window. In a certain system, the native_window_type can be converted into system native handle type.
auto reinterpret_cast<HWND>(root_widget.native_handle()); //Windows
auto reinterpret_cast<Window>(root_widget.native_handle()); //Linux/X11
I may get hint between HWND, Window.
If I use Window(X11), can I implement to opengl on nana library?
To create an app that uses OpenGL you need, very very simplified, at least four things:
wglChoosePixelFormatARB. In Linux,glXChooseFBConfig.wglCreateContextAttribsARBrequires aHDCand in LinuxglXCreateContextAttribsARBaDisplay, which is not the same as a window.You can learn more here and here.
If you find documentation on these matters for OpenGL version < 3.2, please don't use it. Stick to "modern" OpenGL.
The issue with
nanais that the example you linked seems to work well for Windows (but old OGL). Nothing is told about Linux. I think you should dig into the source code ofnanasearching for what it returns onnative_handle(). Better you prefer to ask in its forum.The above functions I showed are not directly available, you must query their function pointers.
And many of modern OGL functions require also to retrieve their function pointers. See the wiki