How to draw opengl graphics from different threads?

后端 未结 3 2140
难免孤独
难免孤独 2021-01-13 15:12

I want to make an opengl application that shows some 3d graphics and a command-line. I would like to make them separate threads, because they both are heavy processes. I tho

3条回答
  •  我在风中等你
    2021-01-13 15:50

    You can't do it with 2 viewports.

    Each OpenGL context must be used from the same thread in which it was created.

    Two separate window handles, each with their own context, can be setup and used from two separate threads safely, but not 2 viewports in one window.


    A good place to look at ideas for this is OpenSceneGraph. It does a lot of work with threading to help try to speed up handling and maintain a constant, high framerate with very large scenes.

    I've successfully embedded it and used it from 2 separate threads, but OSG has many checks in place to help with this sort of scenario.

提交回复
热议问题