Skip to content

ImTextureID is bound as the wrong type. #527

@NogginBops

Description

@NogginBops

As of ImGui v1.91.4 ImTextureID is no longer defined as void* but is instead bound as ImU64.
This causes struct layout problems for 32 bit builds where the layout of the struct is now wrong.

From: https://github.com/ocornut/imgui/blob/947aa9c9722bd6ff740dd757da609ff41f4d3ba3/imgui.h#L261

// ImTexture: user data for renderer backend to identify a texture [Compile-time configurable type]
// - To use something else than an opaque void* pointer: override with e.g. '#define ImTextureID MyTextureType*' in your imconfig.h file.
// - This can be whatever to you want it to be! read the FAQ about ImTextureID for details.
// - You can make this a structure with various constructors if you need. You will have to implement ==/!= operators.
// - (note: before v1.91.4 (2024/10/08) the default type for ImTextureID was void*. Use intermediary intptr_t cast and read FAQ if you have casting warnings)
#ifndef ImTextureID
typedef ImU64 ImTextureID;          // Default: store a pointer or an integer fitting in a pointer (most renderer backends are ok with that)
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions