Another newbie question:
I am in a Win10/MSVS 2015 environment and using freeglut to interface with the windowing system.
I have created a Vulkan instance, now want to create a surface. So I enabled KHR extensions as below in instance creation:
std::vector<const char*> enabledExtensions; enabledExtensions.push_back("VK_KHR_surface"); enabledExtensions.push_back("VK_KHR_win32_surface"); createInfo.enabledExtensionCount = enabledExtensions.size(); createInfo.ppEnabledExtensionNames = &enabledExtensions;
Next, to make the surface I start with:
VkWin32SurfaceCreateInfoKHR createInfo; createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; createInfo.hwnd = windowHandle; createInfo.hinstance = processHandle;
And there’s where I run into trouble. There’s a red line under VkWin32SurfaceCreateInfoKHR. I guess this has to do with including some header file but not sure what.
Follow-up question after, hopefully, the above is resolved. To create the surface I have
VkResult result = vkCreateWin32SurfaceKHR(instance, &createInfo, NULL, &surface);
Again vkCreateWin32SurfaceKHR is underlined so same problem there I guess. But is this the correct statement in the first place? Reason I ask is that I have seen code in another tutorial which uses a statement containing PFN_vkCreateWin32SurfaceKHR - I don’t understand the PFN_ deal at all.
Btw, I use the following to find the window and process handles:
processHandle = GetModuleHandle(nullptr); windowHandle = FindWindow(NULL, LPCTSTR("Window title"));
Correct I hope.
Another thing, I know that GLFW is more Vulkan-friendly then freeglut but I’ve used freeglut a lot with OpenGL so want to keep with it.