# Multiple windows on multiple monitors

**URL:** https://discourse.glfw.org/t/multiple-windows-on-multiple-monitors/77
**Category:** support
**Created:** [July 4, 2014, 12:27am UTC](https://discourse.glfw.org/t/multiple-windows-on-multiple-monitors/77 "2014-07-04T00:27:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)
#### Post date: [July 4, 2014, 12:27am UTC](https://discourse.glfw.org/t/multiple-windows-on-multiple-monitors/77/1 "2014-07-04T00:27:32Z")

</div>

**[dteinferno](https://sourceforge.net/u/dteinferno/)** wrote on [Friday, July 04, 2014](https://sourceforge.net/p/glfw/discussion/247562/thread/27ea7dfd/#aab5):

I’ve been building a setup with three projectors illuminating a cylindrical screen. To that end, I’m trying to create a scene with three different windows that each are full screen on one of the projectors. I was able to follow an online tutorial ([http://blog.gvnott.com/2013/05/18/tutorial-multiple-windows-with-glfw3-and-glew-mx/](http://blog.gvnott.com/2013/05/18/tutorial-multiple-windows-with-glfw3-and-glew-mx/)) to create multiple windows with different contexts. However, when I try to make the windows run full screen on the projectors by adding

```auto
int count;
GLFWmonitor** monitors = glfwGetMonitors(&count);

```

and then changing the first nullptr in CreateWindow(c\_iDefaultScreenWidth, c\_iDefaultScreenHeight, “First”, nullptr, nullptr) to monitors[1] in the first case and monitors[2] in the second, I only see the image on the second window while the first window is black. Any ideas what I’m doing wrong? Thanks!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex035/uploads/glfw/original/1X/b8cdefe6b61b8d5aee6c43b2c56e9cf5eabecfe4.svg) [@system](https://discourse.glfw.org/u/system)
#### Post date: [July 14, 2014, 3:01am UTC](https://discourse.glfw.org/t/multiple-windows-on-multiple-monitors/77/2 "2014-07-14T03:01:16Z")

</div>

**[gvnott](https://sourceforge.net/u/gvnott/)** wrote on [Monday, July 14, 2014](https://sourceforge.net/p/glfw/discussion/247562/thread/27ea7dfd/#c492):

C/C++ arrays are zero based, try using monitors[0] and monitors[1] instead.

Also there are some bugs in GLFWs handling of full screen windows, e.g:  
[https://github.com/glfw/glfw/issues/143](https://github.com/glfw/glfw/issues/143)

You might want to download and build GLFW from the latest source to get these fixes.

---

<div class="post-metadata">

### Author: ![learn2Pro](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/learn2pro/32/528_2.png) [@learn2Pro](https://discourse.glfw.org/u/learn2Pro)
#### Post date: [May 23, 2021, 3:28am UTC](https://discourse.glfw.org/t/multiple-windows-on-multiple-monitors/77/3 "2021-05-23T03:28:41Z")

</div>

is there any sample code? i need this too, but the blog closed

---

<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: [May 23, 2021, 3:17pm UTC](https://discourse.glfw.org/t/multiple-windows-on-multiple-monitors/77/4 "2021-05-23T15:17:29Z")

</div>

I have now corrected the links in this post with the example of how to create multiple windows:

> [@How to create multiple window?](https://discourse.glfw.org/t/how-to-create-multiple-window/1398):
>
> In some games,like Minecraft,they have two windows,one for the game and one launcher to launch the game. So in GLFW,how do I create multiple window?? I know I need to use glfwMakeContextCurrent to choose which window you are currently using,but how do i program the game loop(poll event and update) for both window??? Example code also,please?? Pseudocode is fine too…
