mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-21 06:13:07 +01:00
GL: Added support for texture array.
This commit is contained in:
@@ -139,7 +139,7 @@ struct BgfxCallback : public bgfx::CallbackI
|
||||
virtual void traceVargs(const char* _filePath, uint16_t _line, const char* _format, va_list _argList) BX_OVERRIDE
|
||||
{
|
||||
dbgPrintf("%s (%d): ", _filePath, _line);
|
||||
dbgPrintfVargs(_format, _argList);
|
||||
dbgPrintf(_format, _argList);
|
||||
}
|
||||
|
||||
virtual uint32_t cacheReadSize(uint64_t _id) BX_OVERRIDE
|
||||
|
||||
@@ -109,7 +109,7 @@ static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _sid
|
||||
data += 4;
|
||||
}
|
||||
|
||||
bgfx::updateTextureCube(_handle, _side, 0, _x, _y, _width, _height, mem);
|
||||
bgfx::updateTextureCube(_handle, 0, _side, 0, _x, _y, _width, _height, mem);
|
||||
}
|
||||
|
||||
static const uint32_t m_textureside = 512;
|
||||
@@ -409,7 +409,7 @@ public:
|
||||
|
||||
// Pitch here makes possible to pass data from source to destination
|
||||
// without need for m_textures and allocated memory to be the same size.
|
||||
bgfx::updateTexture2D(m_texture2d, 0, tx, ty, tw, th, mem, pitch);
|
||||
bgfx::updateTexture2D(m_texture2d, 0, 0, tx, ty, tw, th, mem, pitch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ class ExampleTerrain : public entry::AppI
|
||||
}
|
||||
|
||||
mem = bgfx::makeRef(&m_terrain.m_heightMap[0], sizeof(uint8_t) * s_terrainSize * s_terrainSize);
|
||||
bgfx::updateTexture2D(m_heightTexture, 0, 0, 0, s_terrainSize, s_terrainSize, mem);
|
||||
bgfx::updateTexture2D(m_heightTexture, 0, 0, 0, 0, s_terrainSize, s_terrainSize, mem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ void Atlas::updateRegion(const AtlasRegion& _region, const uint8_t* _bitmapBuffe
|
||||
}
|
||||
}
|
||||
|
||||
bgfx::updateTextureCube(m_textureHandle, (uint8_t)_region.getFaceIndex(), 0, _region.x, _region.y, _region.width, _region.height, mem);
|
||||
bgfx::updateTextureCube(m_textureHandle, 0, (uint8_t)_region.getFaceIndex(), 0, _region.x, _region.y, _region.width, _region.height, mem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -337,14 +337,16 @@ namespace
|
||||
|
||||
if (NULL != mem)
|
||||
{
|
||||
bgfx::updateTexture2D(tex->id
|
||||
, 0
|
||||
, 0
|
||||
, 0
|
||||
, tex->width
|
||||
, tex->height
|
||||
, mem
|
||||
);
|
||||
bgfx::updateTexture2D(
|
||||
tex->id
|
||||
, 0
|
||||
, 0
|
||||
, 0
|
||||
, 0
|
||||
, tex->width
|
||||
, tex->height
|
||||
, mem
|
||||
);
|
||||
}
|
||||
|
||||
return bgfx::isValid(tex->id) ? tex->id.idx : 0;
|
||||
@@ -368,15 +370,17 @@ 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::copy(data + y*pitch + x*bytesPerPixel, h*pitch)
|
||||
, pitch
|
||||
);
|
||||
bgfx::updateTexture2D(
|
||||
tex->id
|
||||
, 0
|
||||
, 0
|
||||
, x
|
||||
, y
|
||||
, w
|
||||
, h
|
||||
, bgfx::copy(data + y*pitch + x*bytesPerPixel, h*pitch)
|
||||
, pitch
|
||||
);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user