1

Already read this this any way that was not what I wanted.

I want to know what exactly happen behind this code when we use this:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

, I mean what processes it takes.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Mr Taha
  • 61
  • 9
  • Have you had a look at the [documentation](https://learn.microsoft.com/en-us/windows/desktop/opengl/glclear)? – Geshode Jul 09 '18 at 08:21
  • Have a read of https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glClear.xml – Richard Critten Jul 09 '18 at 08:22
  • its identical with khronos document and there wasnt detail that i needed or maybe i am silly and it dosent tell whats happen behind the code it just tells what it does – Mr Taha Jul 09 '18 at 08:22
  • It clears: ``GL_COLOR_BUFFER_BIT``: back buffer and ``GL_DEPTH_BUFFER_BIT``: depth buffer – Asesh Jul 09 '18 at 08:29
  • 1
    You question is unclear then. Graphics drivers are written by the hardware device manufacturer and so long as the API calls follow the specification only the device manufacturer needs to know the internal details of each call. – Richard Critten Jul 09 '18 at 08:29
  • (for more detail i want to know what  " | " does here and want to know  that glClear , clears both of them in one term or one by one – Mr Taha Jul 09 '18 at 08:36
  • 2
    The | operator is a bit-wise operator. Concatenating bit masks like this tells the driver which buffers it needs to clear. In your example, this would be the color buffer (actual pixels), and the depth buffer (buffer to tell open-gl which pixels to ignore due to depth test failures). The process can cost some performance (depending on the drivers), so make sure you're not spamming calls to glClear when not required. – Gil Moshayof Jul 09 '18 at 09:30

0 Answers0