emscripten-core / emscripten-core/emscripten

glfwInit fails with js error

Open
#17,309 1 comment 0 reactions 0 assignees View on GitHub
GLFW
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Hello. I'm trying to run game that uses glfw. But when glfwInit() is executed, an error is returned to the console.

The function in which this happens:
```
static int
openGLFW(EngineOpenParams *openparams)
{
glGlobals.winWidth = openparams->width;
glGlobals.winHeight = openparams->height;
glGlobals.winTitle = openparams->windowtitle;
glGlobals.pWindow = openparams->window;

memset(&gl3Caps, 0, sizeof(gl3Caps));

/* Init GLFW */
if(!glfwInit()){
RWERROR((ERR_GENERAL, "glfwInit() failed"));
return 0;
}
glGlobals.monitor = glfwGetMonitors(&glGlobals.numMonitors)[0];
makeVideoModeList();
return 1;
}
```
Console output:
![image](https://user-images.githubusercontent.com/76425668/175546658-c3a977ad-178e-451f-b316-775b57d915f8.png)

Built with these libraries:
`-lopenal -lmpg123 -lpthread -lGLESv2 -lglfw `

Built wit these linker params:
`-m32 -sERROR_ON_UNDEFINED_SYMBOLS=0 -sLINKABLE=1 -sEXPORT_ALL=1 -sUSE_PTHREADS=1 -sUSE_GLFW=3 -sUSE_WEBGL2=1 -sFULL_ES2 -sPTHREAD_POOL_SIZE=4 -sPROXY_TO_PTHREAD -sALLOW_MEMORY_GROWTH=1 -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[\'emscripten_builtin_memalign\'] -sSTACK_OVERFLOW_CHECK=1 -sSAFE_HEAP=1 -sDETERMINISTIC=1 -sNO_EXIT_RUNTIME=1 -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -sAUTO_JS_LIBRARIES -gsource-map --preload-file . -o index.html --source-map-base http://172.19.165.84:8000/
`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.