Trying to set window size using native/common functions via entry::setWindowSize, but somehow the window size is still setting it to 1280x720.
The buffer size was successfully set to the preferred size (800x600) though as per screenshot below.
Testing this on Windows 10. Am I missing something?
m_width = 800;
m_height = 600;
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
init.platformData.ndt = entry::getNativeDisplayHandle();
entry::setWindowSize(entry::kDefaultWindowHandle, m_width, m_height);
init.resolution.width = m_width;
init.resolution.height = m_height;
init.resolution.reset = m_reset;
bgfx::init(init);
Solved. It was a bug and the author just fixed this issue:
https://github.com/bkaradzic/bgfx/commit/4f3ce6abcb05f0bf154ef447136793bfe2a7da92 https://github.com/bkaradzic/bgfx/discussions/3022#discussioncomment-4678807
For those who have an older version of bgfx: In
examples/common/entry/entry.cpp
, entry::setWindowSize
should be called first before init()
int runApp(AppI* _app, int _argc, const char* const* _argv)
{
setWindowSize(kDefaultWindowHandle, s_width, s_height);
_app->init(_argc, _argv, s_width, s_height);
bgfx::frame();