Setting the Application name

Started by Scoopta, December 31, 2016, 03:49:25

Previous topic - Next topic

Scoopta

I'm trying to set the applicaiton name by doing:
VkApplicationInfo appInfo = VkApplicationInfo.malloc().pApplicationName(ByteBuffer.wrap("Vulkan Test\0".getBytes()));

But whenever I print it back using:
System.out.println(appInfo.pApplicationNameString());

I get null as the result. What am I doing wrong. I've tried to find documentation but it seems like the vulkan documentation for LWJGL is a bit lackluster.

CoDi

ByteBuffer.wrap() returns a buffer managed by the Java heap. This doesn't work with native data structures.

I recommend lwjgl3-demos repository as a nice reference to start with. In this case, the org.lwjgl.system.MemoryUtil class provides utility functions to work with.

spasi

Using Vulkan without first being familiar with the basics of LWJGL is bound to be an unpleasant experience. A few must-reads from the LWJGL wiki:

Memory FAQ
Bindings FAQ
Troubleshooting

I would also highly recommended playing with the LWJGL samples and demo suite. Make sure you're comfortable with LWJGL bindings in general, before diving into Vulkan (which is a far from easy API to use).

Quote from: Scoopta on December 31, 2016, 03:49:25I've tried to find documentation but it seems like the vulkan documentation for LWJGL is a bit lackluster.

LWJGL includes javadoc that covers the entirety of the Vulkan reference pages. I'm not sure what more would you need. The Vulkan specification and the very helpful validation/debug layers from the LunarG SDK are outside the scope of LWJGL.

Scoopta

Quote from: spasi on December 31, 2016, 10:01:55
which is a far from easy API to use
Yeah I figured that one out pretty quickly. I had expectations going in that it wasn't going to be easy because it is a really low level API and I knew what to expect to a certain extent but it's more than I anticipated.

Quote from: spasi on December 31, 2016, 10:01:55
Using Vulkan without first being familiar with the basics of LWJGL is bound to be an unpleasant experience. A few must-reads from the LWJGL wiki:

Memory FAQ
Bindings FAQ
Troubleshooting
I'll make sure to check those out. I have been making progress following Vulkan Tutorial. It's been slow and somewhat painful but I have been making some progress.

Quote from: spasi on December 31, 2016, 10:01:55
Quote from: Scoopta on December 31, 2016, 03:49:25I've tried to find documentation but it seems like the vulkan documentation for LWJGL is a bit lackluster.

LWJGL includes javadoc that covers the entirety of the Vulkan reference pages. I'm not sure what more would you need. The Vulkan specification and the very helpful validation/debug layers from the LunarG SDK are outside the scope of LWJGL.
Yeah...the docs are clear it's just the parts like the memory thing with ByteBuffer that I didn't know about which is probably my fault for trying to just jump in.
Quote from: CoDi on December 31, 2016, 08:56:15
ByteBuffer.wrap() returns a buffer managed by the Java heap. This doesn't work with native data structures.
I didn't realize that and all the example code was using memEncodeUTF8 which I assume is from an older LWJGL version and I couldn't for the life of me figure out what class that was from because it no longer existed. I eventually realized that it was changed to memUTF8 and is part of MemoryUtil.

Kai

Of the lwjgl3-demos you might want to start with: https://github.com/LWJGL/lwjgl3-demos/tree/master/src/org/lwjgl/demo/intro
With Vulkan, which is stack-allocation-heavy, this can also be of interest to you: https://github.com/LWJGLX/autostack

Scoopta

Quote from: Kai on December 31, 2016, 10:55:36
Of the lwjgl3-demos you might want to start with: https://github.com/LWJGL/lwjgl3-demos/tree/master/src/org/lwjgl/demo/intro
With Vulkan, which is stack-allocation-heavy, this can also be of interest to you: https://github.com/LWJGLX/autostack
Ok thanks! I'll give those demos a look. I probably won't make use of autostack only because I want to use as little off the shelf code as I can but at least I know it's an option.

Eartha

I WILL RECOMMEND lwjgl3-demos HAVE A LOOK FOR IT YOU WILL UNDERSTAND HOW IT IS DONE AND HOW NOT TO DO IT