PDA

View Full Version : Extracting view from a location as a texture



Arkathorn
07-11-2015, 09:43 PM
Is there any way to extract the view from a specified location, and save it as a texture? If not, what is the most efficient or most actually possible way of binding a texture of such a view to a quad? Shaders?

Alfonse Reinheart
07-12-2015, 05:34 AM
Is there any way to extract the view from a specified location, and save it as a texture?

You render the scene to that texture. You attach the texture to an FBO (https://www.opengl.org/wiki/Framebuffer_Object), bind that FBO to the draw framebuffer (https://www.opengl.org/wiki/Framebuffer#Bind_points), and then render the scene.

You'll probably also want to create a depth buffer (https://www.opengl.org/wiki/Depth_Test#Depth_buffer) and attach it to the FBO too. Otherwise, you don't get depth testing.