Hello Guest

Setting the Application name

  • 5 Replies
  • 2633 Views
Setting the Application name
« 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.

*

Offline CoDi

  • *
  • 46
Re: Setting the Application name
« Reply #1 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 to start with. In this case, the org.lwjgl.system.MemoryUtil class provides utility functions to work with.

*

Offline spasi

  • *****
  • 1990
    • WebHotelier
Re: Setting the Application name
« Reply #2 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 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).

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.

Re: Setting the Application name
« Reply #3 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
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.

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.
« Last Edit: December 31, 2016, 10:57:32 by Scoopta »

*

Kai

Re: Setting the Application name
« Reply #4 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

Re: Setting the Application name
« Reply #5 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.