Closed SuperDIMMaX closed 4 years ago
What's the filename of your compiled bgfx dynamic library? loadBgfx
tries to load the DLL with these following names:
const(char)[][4] libNames =
[
"bgfx.dll",
"bgfx-shared-libRelease.dll",
"bgfx_debug.dll",
"bgfx-shared-libDebug.dll"
];
... or alternatively you can give it a custom name as a parameter loadBgfx("my_bgfx.dll")
.
For static library, you probably need to link against user32.lib
to fix the linker error.
Static linked with SDL and bgfx need (not shure, but working)
"user32",
"kernel32",
"opengl32",
"secur32",
"winmm",
"msdmo",
"gdi32",
"winspool",
"shell32",
"comdlg32",
"OLE32",
"imm32",
"oleaut32",
"version",
"uuid",
"advapi32",
"setupapi",
"psapi",
and
"./libs/SDL2-static",
"./libs/astc-codec",
"./libs/astc",
"./libs/bgfx",
"./libs/bimg",
"./libs/bx",
"./libs/edtaa3",
"./libs/etc1",
"./libs/etc2",
"./libs/iqa",
"./libs/nvtt",
"./libs/pvrtc",
"./libs/squish"
and no linker errors,
and no errors with Program exited with code -1073741819
...
but not working...
bgfx_init_t init;
bgfx_init_ctor(&init);
auto i = bgfx_init(&init);
writeln(i);
bgfx_reset(1280, 720, BGFX_RESET_NONE, init.resolution.format);
bgfx_shutdown();
print "true" ... and what is bgfx_init_ctor?
bgfx and sdl - working... examples not working
if need somebody working example -
import bindbc.bgfx;
import bindbc.sdl;
int main(string[] args)
{
ushort WIDTH = 800;
ushort HEIGHT= 600;
SDL_Window* window = SDL_CreateWindow("df", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WIDTH,HEIGHT, SDL_WindowFlags.SDL_WINDOW_SHOWN);
SDL_SysWMinfo windowWMInfo;
SDL_VERSION(&windowWMInfo.version_);
SDL_GetWindowWMInfo(window, &windowWMInfo);
bgfx_platform_data_t pd;
pd.ndt = null;
pd.nwh = windowWMInfo.info.win.window;
bgfx_set_platform_data(&pd);
bgfx_render_frame(10);
bgfx_init_t init;
init.type = bgfx_renderer_type_t.BGFX_RENDERER_TYPE_OPENGL;
init.debug_ = true;
bgfx_init_ctor(&init);
bgfx_init(&init);
bgfx_reset(WIDTH, HEIGHT, BGFX_RESET_VSYNC, init.resolution.format);
bgfx_set_debug(BGFX_DEBUG_TEXT | BGFX_DEBUG_STATS);
bgfx_set_view_clear(0, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH, 0x443355FF, 1.0, 0);
bgfx_set_view_rect(0, 0, 0, WIDTH, HEIGHT);
bgfx_touch(0);
bgfx_dbg_text_printf(0, 0, 0x0f, "TEST");
bool quit = false;
SDL_Event currentEvent;
while(!quit) {
while(SDL_PollEvent(¤tEvent) != 0) {
if(currentEvent.type == SDL_QUIT) {
quit = true;
}
}
bgfx_frame(true);
}
bgfx_shutdown();
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
and
"lflags":["/NODEFAULTLIB:libcmt"], -- need add or many errors.
{
"name": "project_d6",
"dependencies": {
"bindbc-bgfx": "0.3.1+106",
"bindbc-loader": "~>0.3.1",
"bindbc-sdl": "~>0.19.0"
},
"lflags":["/NODEFAULTLIB:libcmt"],
"subConfigurations": {
"bindbc-bgfx": "static",
"bindbc-sdl": "static"
},
"libs":[
"user32",
"./libs/SDL2-static",
"./libs/astc-codec",
"./libs/astc",
"./libs/bgfx",
"./libs/bimg",
"./libs/bx",
"./libs/edtaa3",
"./libs/etc1",
"./libs/etc2",
"./libs/iqa",
"./libs/nvtt",
"./libs/pvrtc",
"./libs/squish"
]
}
I compile bgfx to dll and copy-paste example and get:
on
bgfx_init_ctor(&init);
-and how compile with static lib? I try, but get errors:
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
andbgfx.lib(renderer_d3d9.obj) : error LNK2019: unresolved external symbol __imp_SetWindowPos referenced in function "public: virtual void __cdecl bgfx::d3d9::RendererContextD3D9::requestScreenShot(struct bgfx::FrameBufferHandle,char const *)" (?requestScreenShot@RendererContextD3D9@d3d9@bgfx@@UEAAXUFrameBufferHandle@3@PEBD@Z)
and LINK : warning LNK4217, LINK : warning LNK4286loadBgfx - not load... loadSDL working