title: Regular window screen capture using openGL
body: <p>I'm trying to my desktop image capture. (All images, including the desktop output to the monitor)</p>
  
  <p>It's easy using window API (BitBlt or CImageClass) and it's not the way I want.</p>
  
  <p>I want do it using opengl. so I found glReadPixel funtion and window TRANSPARENT.</p>
  
  <p>But it just read pixel own Windows application screen.(Save as bmp file and check)</p>
  
  <p>Initialize() </p>
  
  <pre><code>glfwSetErrorCallback(errorCallback);
  
  if (!glfwInit()) {
      std::cerr &lt;&lt; "Error: GLFW " &lt;&lt; std::endl;
      exit(EXIT_FAILURE);
  }
  glfwWindowHint(GLFW_DEPTH_BITS, 16);
  glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE);
  
  glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
  glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
  glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
  glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
  glfwWindowHint(GLFW_SAMPLES, 4);
  
  
  const int Monitor_count = GetMonitors();
  
  GLwindow = glfwCreateWindow(
      nWidth, // width
      nHeight, // height
      "OpenGL_Test", // window title
      NULL, NULL);
  if (!GLwindow) {
      glfwTerminate();
      exit(EXIT_FAILURE);
  }
  glfwSwapInterval(1);
  
  
  if (glfwGetWindowAttrib(GLwindow, GLFW_TRANSPARENT_FRAMEBUFFER))
  {
      //...
  }
  glfwSetWindowOpacity(GLwindow, 0.0f);
  
  auto Mode = glfwGetVideoMode(Monitor[0]);   
  
  glfwMakeContextCurrent(GLwindow);   
  glfwSetKeyCallback(GLwindow, keyCallback);
  
  glewExperimental = GL_TRUE;                                         
  GLenum errorCode = glewInit();
  
  if (GLEW_OK != errorCode) {
  
      std::cerr &lt;&lt; "Error: GLEW - " &lt;&lt; glewGetErrorString(errorCode) &lt;&lt; std::endl;
      glfwTerminate();
      exit(EXIT_FAILURE);
  }
  if (!GLEW_VERSION_3_3) {
  
      std::cerr &lt;&lt; "OpenGL 3.3 API is not available." &lt;&lt; std::endl;
  
      glfwTerminate();
      exit(EXIT_FAILURE);
  }
  
  glViewport(0, 0, nWidth, nHeight);
  
  glBindFramebuffer(GL_FRAMEBUFFER, 0);
  
  if (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE) {
      std::cerr &lt;&lt; "Error: " &lt;&lt; std::endl;
  }
  
  return true;
  </code></pre>
  
  <p>Roop</p>
  
  <pre><code>while (!glfwWindowShouldClose(GLwindow)) {
  
      Sleep(10);
  
      glClearColor(0.0f, 0.3f, 0.3f, 0.5f);
      glClear(GL_COLOR_BUFFER_BIT);
  
      unsigned char *image = (unsigned char*)malloc(sizeof(unsigned char)*nWidth*nHeight * 3);
  
         glReadPixels(0, 0, nWidth, nHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, image);
      glfwPollEvents();
  
  }
  
  return true;
  </code></pre>
  
  <p>Q1. Is it possible desktop capture(Full Image GPU output) with OPENGL?</p>
  
  <p>Q2. If Q1 is possible, Should I use FBO and PBO GL_BACK??</p>
  
  <p>Q3. How to access to mother window or GPU adapter? >> GL seems to strongly reject this.(I don't want any rendering, just read pixel data from GPU(Desktop image. not rendered by my application.)(If it is possible ...))</p>
  
  <p>Anybody shows to me about link or idea?</p>