State of Accelerated OpenGL

You can use BGLView::LockGL, UnlockGL, and SwapBuffers methods:
https://www.haiku-os.org/legacy-docs/bebook/BGLView.html

LockGL stores the context into thread-local storage, then you can use OpenGL calls from the thread that locked the context.

Simple examples of GL apps are the screen savers (http://cgit.haiku-os.org/haiku/tree/src/add-ons/screen_savers/glife) or Haiku3D (http://cgit.haiku-os.org/haiku/tree/src/apps/haiku3d).

Alternatively, the GCC5 version of Mesa comes with EGL support, so you can use the EGL APIs as well.