mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-20 22:03:12 +01:00
nanovg: Allow texture update after creation.
This commit is contained in:
@@ -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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user