Raytracing in OpenGL using Compute Shaders I Recently posted this question on SO but didn't got any response so i thought to post it here since it's somewhat related to Raytracing. 

I am making a real time ray tracer in OpenGL using Compute Shaders for my project and was following this link as a reference. The link tells to first draw a full screen quad, then store all the individual pixel colors gotten through intersections in a texture and render the texture to the quad.

However i was thinking can't we use Frame Buffer Objects to display the texture image instead of rendering the quad and save the over head?

Like I save all the colors using ImageStore and GlBindImageTexture in a texture, then attach it to a FBO to display it. And since I won't be using any rendering commands I won't be causing a Feedback loop as in writing and reading the same texture?

Here is the snippet

  void initialization() {
  int tex = create new texture object

  setup min/mag NEAR filtering for that texture
  initialize texture as 2D rgba32f FLOAT and some width/height

  int vao = create VertexArrayObject of full-screen-quad
  // This quad is used to render our
  // "framebuffer" texture onto the screen.

  int computeProgram = create-and-link program with single compute shader object

  int quadProgram = create-and-link simple full-screen quad vertex and fragment shader
  // The fragment shader would fetch
  // texels from our "tex" texture.

  Setup constant uniforms in quad program, such as "tex" texture unit = 0
}



 The rendering process to produce one frame will be as follows:

Bind the Compute Shader
Setup camera properties in compute shader uniforms
Bind level 0 of framebuffer texture to image binding point 0
Start/dispatch the compute shader to generate a frame in the framebuffer image
Unbind image binding point
Bind the written framebuffer texture in OpenGL to texture unit 0
Bind the full-screen shader program
Bind the full-screen-quad VAO
Draw the VAO
Release all bindings
So i searched a lot after this and I think it was my confusion on FrameBuffer Objects.

I thought you could use FBO's just like a default FrameBuffer and display the texture image attached to it but you can't. It's only used for offscreen rendering. So while you can use rendering commands to draw something to a "texture image" attached to it, you can't "display the image" by making it default framebuffer or something like that.