-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImGui.image() should expect long instead of int for textureId. #185
Comments
@enesaltinkaya, did you find a solution? |
I downloaded the repo, changed these to accept long; public static native void image(long textureID, float sizeX, float sizeY); /*
ImGui::Image((ImTextureID)(intptr_t)textureID, ImVec2(sizeX, sizeY));
*/
public static native void image(long textureID, float sizeX, float sizeY, float uv0X, float uv0Y); /*
ImGui::Image((ImTextureID)(intptr_t)textureID, ImVec2(sizeX, sizeY), ImVec2(uv0X, uv0Y));
*/
public static native void image(long textureID, float sizeX, float sizeY, float uv0X, float uv0Y, float uv1X, float uv1Y); /*
ImGui::Image((ImTextureID)(intptr_t)textureID, ImVec2(sizeX, sizeY), ImVec2(uv0X, uv0Y), ImVec2(uv1X, uv1Y));
*/
public static native void image(long textureID, float sizeX, float sizeY, float uv0X, float uv0Y, float uv1X, float uv1Y, float tintColorR, float tintColorG, float tintColorB, float tintColorA); /*
ImGui::Image((ImTextureID)(intptr_t)textureID, ImVec2(sizeX, sizeY), ImVec2(uv0X, uv0Y), ImVec2(uv1X, uv1Y), ImVec4(tintColorR, tintColorG, tintColorB, tintColorA));
*/
public static native void image(long textureID, float sizeX, float sizeY, float uv0X, float uv0Y, float uv1X, float uv1Y, float tintColorR, float tintColorG, float tintColorB, float tintColorA, float borderR, float borderG, float borderB, float borderA); /*
ImGui::Image((ImTextureID)(intptr_t)textureID, ImVec2(sizeX, sizeY), ImVec2(uv0X, uv0Y), ImVec2(uv1X, uv1Y), ImVec4(tintColorR, tintColorG, tintColorB, tintColorA), ImVec4(borderR, borderG, borderB, borderA));
*/ Then i searched for corresponding calls (ImGui::Image((ImTextureID)... calls) in .cpp or .c files in the project, changed those too to accept 64bit ints. But then i dropped java altogether and went back to C. :) I have those dll and so files, and java files if you want them. |
Displaying OpenGL textures using ImGui.image(...) should work without any issues. |
Thank you! I will try to follow your steps but if it doesn't work it'd be usefull to have working files. |
Yeah, of course. Just thought it was possible to use openGl along with Vulkan specifically to render image in ImGui. Well, maybe it sounds silly, sorry, this is too new for me. |
Original C++ function ImGui::Image(..) wants an 32bit integer type if we are using OpenGL. Because glGenTextures outputs an unsigned int. But the same functions wants an 64bit integer type if we are using Vulkan. Address of the VkDescriptorSet. But we can't pass 64bit integer (long) in this repo, so we can't display images using Vulkan. |
My vulkan-image-display-working set of files :) As for C vs Java; Java project, with all those lwjgl jar files, after proguard, jlink, jpackage, release directory is 125mb for linux. It is big because it contains a subset of jdk, jlink does that. And dynamic libraries that are in lwjgl jar files (.so and .dll files). Same project using C, output is 6.5mb :) Using 13 libraries all statically linked. I also kind of like manual memory management, no more garbage collection for me :) Although this is a simple scene, i tested with busy scenes as well. These stats were always slower on Java. |
@enesaltinkaya, thank you. I've been trying to render an image in ImGui with Vulkan for 3 days btw |
If it still wont work you can add me on Discord, username is gnu4493. |
ok, I sent a request |
Version
1.86.10
What happened?
While using with Vulkan, ImGui::Image expects a VkDescriptorSet as it's first parameter, which is a pointer, which is 64bits.
Our ImGui.image() expects an int which is 32bits. So it is not possible to render an image if using Vulkan at the moment.
If I'm mistaken and there is a way to render images while using Vulkan please let me know.
Thanks.
Reproduction
Simply casting wont work as you can see.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: