Skip to content

Commit

Permalink
sokol_nuklear.h: fix sg_image handling (fixes floooh#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Apr 25, 2022
1 parent cc13a1e commit 9a6237f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion util/sokol_nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -1941,8 +1941,15 @@ SOKOL_API_IMPL void snk_render(int width, int height) {
int idx_offset = 0;
nk_draw_foreach(cmd, &_snuklear.ctx, &cmds) {
if (cmd->elem_count > 0) {
sg_image img;
if (cmd->texture.id != 0) {
img = (sg_image){ .id = (uint32_t) cmd->texture.id };
}
else {
img = _snuklear.img;
}
sg_apply_bindings(&(sg_bindings){
.fs_images[0] = _snuklear.img,
.fs_images[0] = img,
.vertex_buffers[0] = _snuklear.vbuf,
.index_buffer = _snuklear.ibuf,
.vertex_buffer_offsets[0] = 0,
Expand Down

0 comments on commit 9a6237f

Please sign in to comment.