nanovg: Allow texture update after creation.

This commit is contained in:
Branimir Karadžić
2016-01-25 09:26:14 -08:00
parent bc85af4572
commit 6af72ce686

View File

@@ -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
);