glDeleteLists in two OpenGL window !!!

If I have two OpenGL window open in the same program. And both of the window call glGenLists to generate unused indices. My question are

  1. Will both of the OpenGL window share the same display list?

  2. If I call glDeleteLists in the first opengl window, will it affected the second opengl window?

It depends.

If you’re not multithreading, then the answer to both questions is no. Even if you share lists between them, each one created and stored their own index. The only way for the two indices to match would be if you were multithreading.

If you are multithreading, then you’re still fine as long as you’re not sharing lists between the two. Two separate windows means you have 2 separate device contexts. Each has its own pool of objects, unless you decided to share objects between the two contexts. If you’re multithreading and sharing lists, then you can have problems.

If you are, then you need to make sure that the glGenLists and glDeleteLists calls are protected by a semaphore lock. And by the same lock. So you can’t simultaneously generate a list while deleting another.

Ya, I am not using multithreading, both of the window have seperate device contexts.
Do you means that, if both of the opengl window have the same display list ID value but is actually a different thing? My problem is once I dispose the second window and I call glDeleteLists to delete the font list which I have created in the second window. The text in the first window will disappear also, but if I call the glGenLists function again for the first window the text will re-appear.

Do you means that, if both of the opengl window have the same display list ID value but is actually a different thing?
Yes. Unless you have chosen to share lists between the two.