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;
117 bool isValidViewId(bgfx::ViewId viewId)
const;
119 bgfx::ViewId requestViewId();
121 void releaseViewId(bgfx::ViewId viewId);
136 bgfx::TextureFormat::Enum
colorFormat = DEFAULT_COLOR_FORMAT,
137 bgfx::TextureFormat::Enum
depthFormat = DEFAULT_DEPTH_FORMAT);
139 void resetDefaultFramebuffer(
142 bgfx::TextureFormat::Enum
colorFormat = DEFAULT_COLOR_FORMAT);
144 bgfx::FrameBufferHandle createFramebufferAndInitView(
153 bgfx::TextureFormat::Enum
colorFormat = DEFAULT_COLOR_FORMAT,
154 bgfx::TextureFormat::Enum
depthFormat = DEFAULT_DEPTH_FORMAT);
156 bgfx::FrameBufferHandle createOffscreenFramebufferAndInitView(
164 bgfx::TextureFormat::Enum
colorFormat = DEFAULT_COLOR_FORMAT,
165 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:152
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:365
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:166