Blit from HMD framebuffer to small window on screen

I am trying to blit the render from right eye in my HMD to my computer screen so other people can watch whats going on in the HMD, but I dont want to use the same screen size. I just want a small 512x512 window on my screen.

When I try to blit from my HMD render with dimensions 1840x1824 (Oculus HMD) to a 512x512 image, I get the following error message:

fatal: error: 0x502, high severity (API)
GL_INVALID_OPERATION error generated. Source and destination dimensions must be identical with the current filtering modes.

I tried both GL_NEAREST and GL_LINEA fliter modes.

my code:

glBindFramebuffer(GL_FRAMEBUFFER, framebuffers[i].id);
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, framebuffers[i].swapchain_images[swapchainIndex].image, 0);
glClearColor(0.1, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glViewport(static_cast(rect.offset.x), static_cast(rect.offset.y),
static_cast(rect.extent.width), static_cast(rect.extent.height));

// HERE I DO THE RENDERING, THEN

if (i == 0) {
// Copy RIGHT EYE to the screen window
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBlitFramebuffer(0, 0, render_target_size.x, render_target_size.y, 0, 0,
viewportSize().x, viewportSize().y, GL_COLOR_BUFFER_BIT, GL_NEAREST);
glFramebufferTexture(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 0, 0);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
}

This is probably what’s biting you:

An INVALID_OPERATION error is generated if either the read or draw framebuffer is multisampled, and the dimensions of the source and destination rectangles provided to BlitFramebuffer are not identical.

Check out:

Or do 2 blits: 1 for downsample, 1 for resize.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.