void OpenGLWindow::Init()
{
	// OpenGL
	//auto surface = new QOffscreenSurface();
	//surface->setFormat(format);
	//surface->create();
	//setSwapInterval

	QSurfaceFormat format;
	format.setVersion(4, 0);
	format.setSwapInterval(0);
	format.setProfile(QSurfaceFormat::CoreProfile);
	setFormat(format);

	auto glfwCTX = glfwGetWGLContext(Engine::Window->window);
	auto window = glfwGetWin32Window(Engine::Window->window);

	auto newNative = new QWGLNativeContext(glfwCTX, window);
	QOpenGLContext* qtctx = new QOpenGLContext();
	//qtctx->setFormat(format);
	qtctx->setNativeHandle(QVariant::fromValue<QWGLNativeContext>(*newNative));
	bool created = qtctx->create();
	bool value = qtctx->makeCurrent(this);

	// Test
	auto nativeHandle = qtctx->nativeHandle();
	auto windowsNative = nativeHandle.value<QWGLNativeContext>();

	// Share context
	qtGLContext = new QOpenGLContext(this);
	//qtGLContext->setFormat(format);
	qtGLContext->setShareContext(qtctx);
	bool success = qtGLContext->create();

	nativeHandle = qtGLContext->nativeHandle();
	windowsNative = nativeHandle.value<QWGLNativeContext>();

	bool sharing = qtGLContext->areSharing(qtctx, qtGLContext);
	bool sharing2 = qtGLContext->shareContext();
}