Dynamically allocated display lists

I need to generate dynamically allocated display lists, I mean, in an application
where the users are to assemble a structure from basic components, that can have different dimensions, it is not possible to know how many components will be used.

How can I use glGenLists(n), where n varies? Or can I just use glGenList(1) every time a component is created?
Will that work? Is this question clear enough?

Thanks in advance!

[QUOTE=joao flavio;1242526]How can I use glGenLists(n), where n varies? Or can I just use glGenList(1) every time a component is created?
Will that work?[/QUOTE]
The latter. Just keep in mind that compiling a list may take an unspecified amount of time.

Also keep in mind:

  • that display lists have been removed in the core profile, so if you want to use them you need a compatibility profile.

  • You can get most of the display list perf with static VBOs and VAOs. You can get all of it with static VBOs and NV bindless extensions, but the latter isn’t cross-vendor yet.