Browse Source

Platform: Add createVkSurface to GlfwApplication

Signed-off-by: Squareys <Squareys@googlemail.com>
pull/202/head
Squareys 10 years ago
parent
commit
de2ba765e3
  1. 17
      src/Magnum/Platform/GlfwApplication.cpp
  2. 8
      src/Magnum/Platform/GlfwApplication.h

17
src/Magnum/Platform/GlfwApplication.cpp

@ -33,6 +33,10 @@
#include "Magnum/Platform/Context.h"
#include "Magnum/Platform/ScreenedApplication.hpp"
#ifdef MAGNUM_TARGET_VULKAN
#include "Magnum/Vk/Context.h"
#endif
namespace Magnum { namespace Platform {
GlfwApplication* GlfwApplication::_instance = nullptr;
@ -237,6 +241,19 @@ void GlfwApplication::mouseReleaseEvent(MouseEvent&) {}
void GlfwApplication::mouseMoveEvent(MouseMoveEvent&) {}
void GlfwApplication::mouseScrollEvent(MouseScrollEvent&) {}
#ifdef MAGNUM_TARGET_VULKAN
VkSurfaceKHR GlfwApplication::createVkSurface() {
VkSurfaceKHR surface;
VkResult res = glfwCreateWindowSurface(Magnum::Vk::Context::current().vkInstance(), _window, nullptr, &surface);
if(res != VK_SUCCESS) {
Error() << "Vulkan Surface creation failed.";
}
return surface;
}
#endif
GlfwApplication::Configuration::Configuration():
_title{"Magnum GLFW Application"},
_size{800, 600}, _sampleCount{0},

8
src/Magnum/Platform/GlfwApplication.h

@ -40,6 +40,10 @@
/* We must include our own GL headers first to avoid conflicts */
#include "Magnum/OpenGL.h"
#ifdef MAGNUM_TARGET_VULKAN
#include "vulkan.h"
#endif
#include <glfw3.h>
namespace Magnum { namespace Platform {
@ -240,6 +244,10 @@ class GlfwApplication {
/*@}*/
#ifdef MAGNUM_TARGET_VULKAN
VkSurfaceKHR createVkSurface();
#endif
private:
static void staticViewportEvent(GLFWwindow*, int w, int h) {
_instance->viewportEvent({w, h});

Loading…
Cancel
Save