MCPcopy Create free account
hub / github.com/brenocq/implot3d / SetTexture

Method SetTexture

implot3d.cpp:3773–3795  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3771}
3772
3773void ImDrawList3D::SetTexture(ImTextureRef tex_ref) {
3774 if (_TextureBuffer.empty()) {
3775 // First texture assignment
3776 _TextureBuffer.push_back({tex_ref, _VtxCurrentIdx});
3777 return;
3778 }
3779
3780 ImTextureBufferItem& prev_item = _TextureBuffer.back();
3781 if (prev_item.VtxIdx == _VtxCurrentIdx) {
3782 // Same vertex index: update existing texture ID
3783 prev_item.TexRef = tex_ref;
3784
3785 // If the previous texture was the same, remove current texture
3786 if (_TextureBuffer.Size >= 2) {
3787 if (_TextureBuffer[_TextureBuffer.Size - 2].TexRef == tex_ref) {
3788 _TextureBuffer.pop_back();
3789 }
3790 }
3791 } else if (prev_item.TexRef != tex_ref) {
3792 // New vertex index and different texture: insert new item
3793 _TextureBuffer.push_back({tex_ref, _VtxCurrentIdx});
3794 }
3795}
3796
3797void ImDrawList3D::ResetTexture() { SetTexture(ImTextureID(0)); }
3798

Callers 1

RenderMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected