# Monitor goes black when glfwSwapBuffers is called

**URL:** <https://discourse.glfw.org/t/monitor-goes-black-when-glfwswapbuffers-is-called/1257>\
**Category:** support\
**Created:** [January 20, 2019, 9:53am UTC](https://discourse.glfw.org/t/monitor-goes-black-when-glfwswapbuffers-is-called/1257 "2019-01-20T09:53:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pjrader1](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/pjrader1/32/226_2.png) [@pjrader1](https://discourse.glfw.org/u/pjrader1)\
**Post date:** [January 20, 2019, 9:53am UTC](https://discourse.glfw.org/t/monitor-goes-black-when-glfwswapbuffers-is-called/1257/1 "2019-01-20T09:53:46Z")

</div>

This is a very strange issue. I’ve used this skeleton code on other platforms (Windows, macOS) but when I run it on Linux (Debian, amdgpu drivers) the entire screen goes black (almost like it’s changing the resolution, but that doesn’t make any sense). [Here is a Pastebin of the code I’m using.](https://pastebin.com/DNmb8Bqa) I use [libepoxy](https://github.com/anholt/libepoxy) for OpenGL functions.

If I call `glfwSwapInterval(0)` then the window opens normally. If I call `glfwSwapInterval(10)` then the screen flashes black and recovers, then about 10 seconds or so later the screen flashes black again. If I comment out `glfwSwapBuffers` then the window opens normally, but I’m wondering if it’s somewhere in my configuration that is causing this.

I built the tests and they run normally, which is why I’m confused by this.

---

<div class="post-metadata">

**Author:** ![pjrader1](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/pjrader1/32/226_2.png) [@pjrader1](https://discourse.glfw.org/u/pjrader1)\
**Post date:** [January 20, 2019, 10:05am UTC](https://discourse.glfw.org/t/monitor-goes-black-when-glfwswapbuffers-is-called/1257/2 "2019-01-20T10:05:49Z")

</div>

I figured it out. You have to call `glClear`.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [January 20, 2019, 12:25pm UTC](https://discourse.glfw.org/t/monitor-goes-black-when-glfwswapbuffers-is-called/1257/3 "2019-01-20T12:25:32Z")

</div>

Glad you’ve resolved your issue.
