Programming > Vulkan
Vulkan - Nuklear
ealrann:
Hello,
I'm trying to use the Nuklear binding, and I have few questions:
- In the GLFWDemo.java:
--- Code: ---// null texture setup
int nullTexID = glGenTextures();
null_texture.texture().id(nullTexID);
--- End code ---
With vulkan, no glGenTextures. What should I put into the field ID (int)? I thought of an Image ID, but it's a long.
- Hard to find any code about Nuklear and Vulkan, but there is this one: https://github.com/m0ppers/nuklear-glfw-vulkan. He's using nk_font_atlas, but I don't see anything like that in the LWJGL binding, maybe I missed something?
spasi:
Hey,
I'm not sure about the null texture.
LWJGL builds nuklear without NK_INCLUDE_FONT_BAKING, which means that the nk_font_atlas functionality is not available. Including it would bundle stb_truetype & stb_rect_pack with nuklear, but those are already available in LWJGL's stb bindings. See the GLFWDemo (lines 141-240) for an example of how you can implement the same functionality.
ealrann:
Hello Spasi,
Yeah, actually I try to convert the GLFWDemo you speak about. But same question with the default_font: line 238:
--- Code: ---.texture(it -> it
.id(fontTexID));
--- End code ---
fontTexID comes from:
--- Code: ---int fontTexID = glGenTextures();
--- End code ---
In Vulkan World, no glGenTextures, and IDs are long, not int; so I'm not sure what to use for this field.
So, for now I replace that by:
--- Code: ---.texture(it -> it
.ptr(vulkanImageId));
--- End code ---
Still have a black screen for now haha.
spasi:
Right, nk_handle is a union, you can use either id or ptr to store a handle. So, ptr is fine for a Vulkan image id.
As for why you get a black screen, note that Nuklear does not perform any rendering. You iterate the generated list of NkDrawCommand and it's up to you do the right OpenGL or Vulkan calls. For example, at line 606 of the existing demo, there's a glBindTexture(GL_TEXTURE_2D, cmd.texture().id()) call. In a Vulkan renderer, you'd use cmd.texture().ptr() instead.
ealrann:
Thanks for your answer.
Yep, I saw that. I already have a functional vulkan pipeline, and I converted the opengl calls into vulkan ones. I just missed something I guess.
I'll share the code if I make it works.
Navigation
[0] Message Index
[#] Next page
Go to full version