Thats an image buffer of uint8_t * pixels
a. Copy image buffer to Texture
void sf::Texture::update ( const Uint8 * pixels )
b. Render using SFML to texture
c. Copy sf::Texture to sf::Image
or
a. Use sf::Image with you buffer copied to sf::Image
b. Copy sf::Image to sf::Texture
c. Copy sf::Texture to sf::Image
Are these the two options you described ?
There is a comparison of direct OpenGL methods here - https://stackoverflow.com/questions/68791782/fastest-way-to-transfer-buffer-texture-data-from-gpu-to-cpu
1)Using glReadPixels - < 3.1ms
glBindTexture(GL_TEXTURE_2D,depthTexture);
glReadPixels(0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT,mat.data);
2)Using glGetTexImage - <2.9ms
glBindTexture(GL_TEXTURE_2D,depthTexture);
glGetTexImage(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, GL_FLOAT, mat.data);
3)Using PBO with glGetTexImage - <2.3ms
glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo);
glBindTexture(GL_TEXTURE_2D, depthTexture);
glGetTexImage(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0);
mat.data = (uchar*)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
Thats an image buffer of uint8_t * pixels
a. Copy image buffer to Texture
void sf::Texture::update ( const Uint8 * pixels )
b. Render using SFML to texture
c. Copy sf::Texture to sf::Image
or
a. Use sf::Image with you buffer copied to sf::Image
b. Copy sf::Image to sf::Texture
c. Copy sf::Texture to sf::Image
Are these the two options you described ?
That's correct. SFML uses glGetTexImage under the hood:
https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/Texture.cpp#L369
(or glReadPixels if using GLES)
and glTexSubImage2D for uploading
https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/Texture.cpp#L425
This might be fine for your needs (I've used it for rendering the output of emulators for example) but it will of course start to suffer with larger video resolutions. You can only really know for sure by testing it out 8)