problem with mass-masking


		 gl.glNewList(displayList[0], GL_COMPILE);

		 gl.glNewList(displayList[1], GL_COMPILE);

		 gl.glNewList(displayList[2], GL_COMPILE);

i’m trying to create 3 display lists, but the last one i compile is saved in displaylist[0]…

sorry, wrong topic name…

If it’s like OpenGL C code then genlists returns the first integer handle in a contiguous list.

So you need to take the return value and assign it to element zero of your display list array, then increment it and apply in to the second element then increment it and apply it to the third etc. As you can see you don’t really need an array.

displayList[0] = gl.glGenLists(3);
displayList[1] = displayList[0]+1;
displayList[2] = displayList[1]+1;

That should fix your code but it might be better to use something like

display_base = gl.glGenLists(3);


and dispense with the array.

C++ wrappers like the OpenGL wrapper you are using are the worst application of C++. Completely useless IMHO.

i’m using java+gl4java, so it’s not useless for me

Ah I see I assumed it was C++, it looks the same in this case. I’d preffer a C style of wrapper but each to their own.

Dorbie’s response still brings up a good point. How is glGenLists filing the values in your displayList array?

I’m not familiar with gl4Java so maybe there’s someplace else where you tell it what array to fill, but from the code you gave, it appears that they have no association.

Yes it sure looks that way. I assume the wrapper is doing exactly what the C call does and the solution is as I have suggested. The whole notion of using an array when the name allocator gives you the base name in a contiguous list seems redundant as I pointed out.

some other display-list-questions :

  • are quads converted into small triangle-strips ?
  • are displaylists stored in the graphic cards ram ?

is there a limit for display lists ? (maximum number of lists or maximum number of commands)

No, quads aren’t converted to triangle strips unless the driver does some sort of optimization underneath. You need to be sure that all the vertices of your quad are coplanar, otherwise the results are undefined.

Display lists can be stored in the graphics memory, but again, it’s all a decision up to where the driver decides to put them.

There is no real limits to the number of commands that can be put into a display list. I believe that if you start putting too much in them, it will slow things down, though.

The only limit on the number of lists you can have is the max value of GLuint, which is pretty large. Again, in practice it may start slowing down if you get too many as there would be less chance to get stored in graphics memory.

Regarding your problem, you still haven’t told us HOW the values for your displayList array are getting set. I’m guessing your problem is stemming from not correctly setting those values.