Skip to content

Commit 8c8eb7c

Browse files
committed
Fix using wrong OpenGL functions on shader compilation error
1 parent 3f4a546 commit 8c8eb7c

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Emscripten")
294294
# target_compile_options(lxgui PUBLIC "SHELL:-s INITIAL_MEMORY=200MB")
295295

296296
target_link_options(lxgui PUBLIC "SHELL:-s DISABLE_EXCEPTION_CATCHING=0")
297-
target_link_options(lxgui PUBLIC "SHELL:-s MAX_WEBGL_VERSION=3")
298297
# Debugging options that can be added:
299298
# target_link_options(lxgui PUBLIC "SHELL:-s ASSERTIONS=2")
300299
# target_link_options(lxgui PUBLIC "SHELL:-s SAFE_HEAP=1")

impl/gui/gl/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ else()
3535
target_link_options(lxgui-gui-gl PUBLIC "SHELL:-s USE_LIBPNG=1")
3636
target_link_options(lxgui-gui-gl PUBLIC "SHELL:-s USE_FREETYPE=1")
3737
target_link_options(lxgui-gui-gl PUBLIC "SHELL:-s MIN_WEBGL_VERSION=2")
38+
target_link_options(lxgui-gui-gl PUBLIC "SHELL:-s MAX_WEBGL_VERSION=2")
3839
endif()
3940

4041
file(GLOB files ${PROJECT_SOURCE_DIR}/include/lxgui/impl/gui_gl*.hpp)

impl/gui/gl/src/gui_gl_renderer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,15 +337,15 @@ GLuint create_shader(GLenum type, const char* shader_source) {
337337
glCompileShader(shader);
338338

339339
// Check sucess
340-
GLint compiled = 0;
340+
GLint compiled = GL_FALSE;
341341
glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
342-
if (compiled == 0) {
342+
if (compiled == GL_FALSE) {
343343
GLint info_length = 0;
344-
glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &info_length);
344+
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_length);
345345

346346
std::vector<char> error_message(std::max(1, info_length), '\0');
347347
if (info_length > 1) {
348-
glGetProgramInfoLog(shader, info_length, NULL, error_message.data());
348+
glGetShaderInfoLog(shader, info_length, NULL, error_message.data());
349349
}
350350

351351
glDeleteShader(shader);

impl/gui/sdl/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ else()
3636
target_link_options(lxgui-gui-sdl PUBLIC "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'")
3737
target_link_options(lxgui-gui-sdl PUBLIC "SHELL:-s USE_SDL_TTF=2")
3838
target_link_options(lxgui-gui-sdl PUBLIC "SHELL:-s MIN_WEBGL_VERSION=1")
39+
target_link_options(lxgui-gui-sdl PUBLIC "SHELL:-s MAX_WEBGL_VERSION=2")
3940
endif()
4041

4142
file(GLOB files ${PROJECT_SOURCE_DIR}/include/lxgui/impl/gui_sdl*.hpp)

impl/input/sdl/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,9 @@ else()
2424
target_compile_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL=2")
2525
target_compile_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL_IMAGE=2")
2626
target_compile_options(lxgui-input-sdl PUBLIC "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'")
27-
target_compile_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL_TTF=2")
2827
target_link_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL=2")
2928
target_link_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL_IMAGE=2")
3029
target_link_options(lxgui-input-sdl PUBLIC "SHELL:-s SDL2_IMAGE_FORMATS='[\"png\"]'")
31-
target_link_options(lxgui-input-sdl PUBLIC "SHELL:-s USE_SDL_TTF=2")
32-
target_link_options(lxgui-input-sdl PUBLIC "SHELL:-s MIN_WEBGL_VERSION=1")
3330
endif()
3431

3532
install(FILES ${PROJECT_SOURCE_DIR}/include/lxgui/impl/input_sdl_source.hpp

0 commit comments

Comments
 (0)