Display list used in more than one control...

I am newbie in opengl programming.
I am using a two different activex controls in my application. In both the controls i used the display list, in which i have dynamically delete and recreate the display. when i dynamically delete and recreate the list in one control, that list is not executing and it affects the existing list of the other control.

Is there any problem in list creation?


I am not sure but I feel you are right. Since a display list is compiled code stored in the server side (you graphics card), when you modify a handle to it in one control the other is affected.

Thanks for your response Optik,

I have tested something for creation of display list and just i want to share this.

I have tested the creation of display list in two different way.

  1. I created the display list within the OnCreate(LPCREATESTRUCT lpCreateStruct) function in both the control.

  2. In this, i created the display list within the invoke method [ GenerateLists() ] in both the control.

I used the message box to display the generated base list id (which is returned from glGenLists) in both the control.

In first condition, the base list id of both controls are same. i.e. it start with list id 1.

In second condition, i called those two invoke methods in my application in which the base list id of both controls returned from glGenLists are different. i.e. For first control the list id start with 1 and for the second it start with 334.
But in this condition, the lists of one control(Ctrl2) only executed properly which is recently inserted control in my application and lists of another control(Ctrl1) are not executing.

Note: Ctrl1 is inserted first in application and Ctrl2 is inserted second in application.

And i have tested the reverse condition also i.e. Ctrl2 is inserted first and Ctrl1 is inserted second in application. In this situation, the lists of Ctrl1 are executing properly and the lists of Ctrl2 are not executing.

Do you have any idea about this?


Hi palzit

I see what your problem is.

It only makes sense calling both the glGenLists() in your application as you mentioned in the second condition. List IDs should be unique.

However I cannot understand why only the latter list is executed.

Also, Please tell me where you are actually building the lists. Are they built in their respective controls or in your application? Have you tried both? If not please do.


Hi Optik,

In both methods i have create, delete and recreate the lists within the corresponding activex control application only.

  1. How do i create the lists in main application instead of creating the lists in activex control application?

  2. Is that possible to create a list with our own specified ID?