Пример #1
0
static void gl_init(HDC hdc)
{
	HWND window = WindowFromDC(hdc);
	bool success = false;
	RECT rc = {0};

	GetClientRect(window, &rc);

	data.base_cx = rc.right;
	data.base_cy = rc.bottom;
	data.hdc = hdc;
	data.format = DXGI_FORMAT_B8G8R8A8_UNORM;
	data.using_scale = global_hook_info->use_scale;
	data.using_shtex = nv_capture_available &&
		!global_hook_info->force_shmem;

	if (data.using_scale) {
		data.cx = global_hook_info->cx;
		data.cy = global_hook_info->cy;
	} else {
		data.cx = data.base_cx;
		data.cy = data.base_cy;
	}

	if (data.using_shtex)
		success = gl_shtex_init(window);
	else
		success = gl_shmem_init(window);

	if (!success)
		gl_free();
}
Пример #2
0
static int gl_init(HDC hdc)
{
	HWND window = WindowFromDC(hdc);
	int ret = INIT_FAILED;
	bool success = false;
	RECT rc = {0};

	GetClientRect(window, &rc);

	data.base_cx = rc.right;
	data.base_cy = rc.bottom;
	data.hdc = hdc;
	data.format = DXGI_FORMAT_B8G8R8A8_UNORM;
	data.using_scale = global_hook_info->use_scale;
	data.using_shtex = nv_capture_available &&
		!global_hook_info->force_shmem &&
		!data.shmem_fallback;

	if (data.using_scale) {
		data.cx = global_hook_info->cx;
		data.cy = global_hook_info->cy;
	} else {
		data.cx = data.base_cx;
		data.cy = data.base_cy;
	}

	if (data.using_shtex) {
		success = gl_shtex_init(window);
		if (!success)
			ret = INIT_SHTEX_FAILED;
	} else {
		success = gl_shmem_init(window);
	}

	if (!success)
		gl_free();
	else
		ret = INIT_SUCCESS;

	return ret;
}