Giter VIP home page Giter VIP logo

Comments (10)

enesaltinkaya avatar enesaltinkaya commented on June 11, 2024 1

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.

from imgui-java.

enesaltinkaya avatar enesaltinkaya commented on June 11, 2024 1

Thank you! I will try to follow your steps but if it doesn't work it'd be usefull to have working files. Why C? :) Have you encountered more problems with everything ported to Java?

My vulkan-image-display-working set of files :)
https://drive.google.com/file/d/1-ispK2iK3NHiacRQvPVmkahNcufqFrZN/view?usp=sharing

As for C vs Java;
Mainly the project output/release size.

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.
When we use statically linked libraries in c or c++ only used portion of libraries included in the final executable.
But if we use dynamic libraries the whole .so or .dll files needs to reside beside the executable.

I also kind of like manual memory management, no more garbage collection for me :)
C apps start very fast.
And even tho java has JIT compiler that makes the application run as fast as native applications I could not see the same performance in my project.

Although this is a simple scene, i tested with busy scenes as well. These stats were always slower on Java.
image

from imgui-java.

Standinalone avatar Standinalone commented on June 11, 2024

@enesaltinkaya, did you find a solution?
Maybe you have a code snippet to use openGl here to display images while it's still an issue?

from imgui-java.

enesaltinkaya avatar enesaltinkaya commented on June 11, 2024

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.
Compiled these two, imgui-java64.dll, libimgui-java64.so.
And it worked.

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.

from imgui-java.

enesaltinkaya avatar enesaltinkaya commented on June 11, 2024

@enesaltinkaya, did you find a solution? Maybe you have a code snippet to use openGl here to display images while it's still an issue?

Displaying OpenGL textures using ImGui.image(...) should work without any issues.
This issue is about displaying them using Vulkan.

from imgui-java.

Standinalone avatar Standinalone commented on June 11, 2024

I have those dll and so files, and java files if you want them.

Thank you! I will try to follow your steps but if it doesn't work it'd be usefull to have working files.
Why C? :) Have you encountered more problems with everything ported to Java?

from imgui-java.

Standinalone avatar Standinalone commented on June 11, 2024

This issue is about displaying them using Vulkan.

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.

from imgui-java.

Standinalone avatar Standinalone commented on June 11, 2024

@enesaltinkaya, thank you. I've been trying to render an image in ImGui with Vulkan for 3 days btw

from imgui-java.

enesaltinkaya avatar enesaltinkaya commented on June 11, 2024

If it still wont work you can add me on Discord, username is gnu4493.

from imgui-java.

Standinalone avatar Standinalone commented on June 11, 2024

If it still wont work you can add me on Discord, username is gnu4493.

ok, I sent a request

from imgui-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.