diff --git a/examples/common/nanovg/nanovg_bgfx.cpp b/examples/common/nanovg/nanovg_bgfx.cpp index 96214a467..fc276ff32 100644 --- a/examples/common/nanovg/nanovg_bgfx.cpp +++ b/examples/common/nanovg/nanovg_bgfx.cpp @@ -329,9 +329,20 @@ namespace , 1 , NVG_TEXTURE_RGBA == _type ? bgfx::TextureFormat::RGBA8 : bgfx::TextureFormat::R8 , BGFX_TEXTURE_NONE - , mem ); + if (NULL != mem) + { + bgfx::updateTexture2D(tex->id + , 0 + , 0 + , 0 + , tex->width + , tex->height + , mem + ); + } + return bgfx::isValid(tex->id) ? tex->id.idx : 0; } @@ -353,7 +364,12 @@ namespace uint32_t bytesPerPixel = NVG_TEXTURE_RGBA == tex->type ? 4 : 1; uint32_t pitch = tex->width * bytesPerPixel; - bgfx::updateTexture2D(tex->id, 0, x, y, w, h + bgfx::updateTexture2D(tex->id + , 0 + , x + , y + , w + , h , bgfx::copy(data + y*pitch + x*bytesPerPixel, h*pitch) , pitch );