LWJGL Forum

Programming => Vulkan => Topic started by: Scoopta on December 31, 2016, 03:49:25

Title: Setting the Application name
Post by: Scoopta on December 31, 2016, 03:49:25
I'm trying to set the applicaiton name by doing:
Code: [Select]
VkApplicationInfo appInfo = VkApplicationInfo.malloc().pApplicationName(ByteBuffer.wrap("Vulkan Test\0".getBytes()));But whenever I print it back using:
Code: [Select]
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.
Title: Re: Setting the Application name
Post by: 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 recommend lwjgl3-demos repository as a nice reference (https://github.com/LWJGL/lwjgl3-demos/blob/master/src/org/lwjgl/demo/vulkan/ClearScreenDemo.java#L92) to start with. In this case, the org.lwjgl.system.MemoryUtil class provides utility functions to work with.
Title: Re: Setting the Application name
Post by: 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 (https://github.com/LWJGL/lwjgl3-wiki/wiki/1.3.-Memory-FAQ)
Bindings FAQ (https://github.com/LWJGL/lwjgl3-wiki/wiki/1.4.-Bindings-FAQ)
Troubleshooting (https://github.com/LWJGL/lwjgl3-wiki/wiki/2.5.-Troubleshooting)

I would also highly recommended playing with the LWJGL samples (https://github.com/LWJGL/lwjgl3/tree/master/modules/core/src/test/java/org/lwjgl/demo) and demo suite (https://github.com/LWJGL/lwjgl3-demos/tree/master/src/org/lwjgl/demo). Make sure you're comfortable with LWJGL bindings in general, before diving into Vulkan (which is a far from easy API to use).

I'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.
Title: Re: Setting the Application name
Post by: Scoopta on December 31, 2016, 10:55:03
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.

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 (https://github.com/LWJGL/lwjgl3-wiki/wiki/1.3.-Memory-FAQ)
Bindings FAQ (https://github.com/LWJGL/lwjgl3-wiki/wiki/1.4.-Bindings-FAQ)
Troubleshooting (https://github.com/LWJGL/lwjgl3-wiki/wiki/2.5.-Troubleshooting)
I'll make sure to check those out. I have been making progress following Vulkan Tutorial (https://vulkan-tutorial.com). It's been slow and somewhat painful but I have been making some progress.

I'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.
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.
Title: Re: Setting the Application name
Post by: 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
Title: Re: Setting the Application name
Post by: Scoopta on January 01, 2017, 20:59:57
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.