Edit:-
I was able to partially solve this, if I load the texture before the function is called in which it resides, like in a header or in program before the function, I can get clickable images but they are just black squares instead of actual images
I had a series of buttons which opened different windows on clicking, and the buttons were called continuously in a for loop of range 5(there are 5 buttons)
if (isShowClose == true)
isClicked = ImGui::Button(name.c_str(), ImVec2(Dp2Px(78), Dp2Px(22)));
else
isClicked = ImGui::Button(name.c_str(), ImVec2(Dp2Px(100), Dp2Px(22)));
Currently this is working, but when I replace this by
if (isShowClose == true)
isClicked = ImGui::Button(name.c_str(), ImVec2(Dp2Px(100), Dp2Px(22)));
else
isClicked = ImGui::ImageButton((void*)(intptr_t)icons[i], ImVec2(30, 30));
The images are displayed properly instead of button names, but they don't respond to the clicks. And icons[i] is a GLuint array of size 5, inside it are the images converted to textures like home_texture, warning_texture, and they are loaded with this code
LoadTextureFromFile("..\\drawable\\home.png", &home_texture, &my_image_width, &my_image_height);
So to check this I added a print statement after the isClicked line for both Button and ImageButton, on clicking it gave 1 for Button, but it remained 0 for ImageButton.
Therefore I got to know that it wasn't even registered as a click, is this related to ButtonBehaviour()?