Multi threads and bgfx #3009
-
I am trying to use bgfx in a thread in our app vs the main thread but it keeps crashing with an error "must be called in main thread" calling bgfx::reset. I compiled the code with BGFX_CONFIG_MULTITHREADED=1 turned on and also off with the same outcome. Can bgfx run in another thread other than the main thread? Does bgfx::init have to be called in the same thread? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Where you call You have to use encoder API in case you want to do draw calls from any other thread than API thread: |
Beta Was this translation helpful? Give feedback.
Where you call
bgfx::init
that becomes API thread. Read docs here:https://bkaradzic.github.io/bgfx/internals.html#api-and-render-thread
You have to use encoder API in case you want to do draw calls from any other thread than API thread:
https://bkaradzic.github.io/bgfx/bgfx.html#encoder