45 void* mWindowHandle =
nullptr;
46 void* mDisplayHandle =
nullptr;
48 std::stack<bgfx::ViewId> mViewStack;
54 inline static bgfx::RendererType::Enum sRenderType =
55 bgfx::RendererType::Count;
60 inline static Context* sInstancePtr =
nullptr;
61 inline static std::mutex sMutex;
65 static constexpr uint32_t DEFAULT_CLEAR_COLOR = 0x000000ff;
66 static constexpr float DEFAULT_CLEAR_DEPTH = 1.0f;
67 static constexpr uint8_t DEFAULT_CLEAR_STENCIL = 0;
68 static constexpr bgfx::TextureFormat::Enum DEFAULT_COLOR_FORMAT =
69 bgfx::TextureFormat::RGBA8;
70 static constexpr bgfx::TextureFormat::Enum DEFAULT_DEPTH_FORMAT =
71 bgfx::TextureFormat::D24S8;
89 static void initHeadless();
91 static bool isInitialized();
93 static void shutdown();
101 static void setDebugVerbosity(
bool verbose);
103 bool isHeadless()
const;
107 bool supportsReadback()
const;
109 bool supportsCompute()
const;
119 bool isValidViewId(bgfx::ViewId viewId)
const;
121 bgfx::ViewId requestViewId();
123 void releaseViewId(bgfx::ViewId viewId);
138 bgfx::TextureFormat::Enum
colorFormat = DEFAULT_COLOR_FORMAT,
139 bgfx::TextureFormat::Enum
depthFormat = DEFAULT_DEPTH_FORMAT);
141 void resetDefaultFramebuffer(
144 bgfx::TextureFormat::Enum
colorFormat = DEFAULT_COLOR_FORMAT);
146 bgfx::FrameBufferHandle createFramebufferAndInitView(
155 bgfx::TextureFormat::Enum
colorFormat = DEFAULT_COLOR_FORMAT,
156 bgfx::TextureFormat::Enum
depthFormat = DEFAULT_DEPTH_FORMAT);
158 bgfx::FrameBufferHandle createOffscreenFramebufferAndInitView(
166 bgfx::TextureFormat::Enum
colorFormat = DEFAULT_COLOR_FORMAT,
167 bgfx::TextureFormat::Enum
depthFormat = DEFAULT_DEPTH_FORMAT);
bool isDefaultWindow(void *windowHandle) const
Checks whether the context is initialized with the provided window handle.
Definition context.cpp:157
static void setResetFlags(uint flags)
Set the reset flags used by the default frame buffer.
Definition context.cpp:108
static void setRenderType(bgfx::RendererType::Enum renderType)
Set the backend renderer type used by bgfx.
Definition context.cpp:89
const bgfx::Caps & capabilites() const
Return the capabilities of the backend renderer.
Definition context.cpp:126
static Context & instance(void *windowHandle=nullptr, void *displayHandle=nullptr)
Return the context instance.
Definition context.cpp:371
static bgfx::RendererType::Enum renderType()
Return the backend renderer type used by bgfx.
Definition context.cpp:67
bgfx::FrameBufferHandle createOffscreenFramebuffer(uint16_t width, uint16_t height, bgfx::TextureFormat::Enum colorFormat=DEFAULT_COLOR_FORMAT, bgfx::TextureFormat::Enum depthFormat=DEFAULT_DEPTH_FORMAT)
Create a framebuffer with with 2 attachments (color and depth)
Definition context.cpp:171