   OpenGL and multi-threading
  Hi!I have a scene graph in my "engine", and a scene is initialized on start-up, before opengl rendered any frame. I now want to have the option to load different scenes while the engine is running and opengl rendering, for loading screens i.e. So I create a thread for Scene::Initialize(); the problem is, that OpenGL doesn't like glGenTextures or glCreateShaderObjectARB etc. to be called during rendering. What I tried then is something like:loop{   renderer->currentlyRendering = true;   renderer->renderCurrentScene();   renderer->currentlyRendering = false;}and then I check if currentlyRendering  is false before calling glGenTextures i.e.but OpenGL still says "invalid operation".What's the trick? I know I can't call glGenTextures while rendering, but there must be some work-around.Thank you!   
  You can only call OpenGL functions from the thread in which the rendering context is active. If you want to make calls from another thread, you have to move the rendering context to that thread, which leaves the original thread without a rendering context instead. There's no way around that.What your other thread can do instead is, for example, to only load the data, and then upload it to OpenGL afterwards. For example, load images and object from disk, and then load the textures and vertex buffers only when you can.   