PDA

View Full Version : problem with mass-masking



HamsterofDeath
12-26-2002, 01:53 PM
gl.glGenLists(3);

gl.glNewList(displayList[0], GL_COMPILE);
GLDraw.executeStrips(testMe);
gl.glEndList();

gl.glNewList(displayList[1], GL_COMPILE);
wald.drawForestTrees(gl,glu,null,texture,treeTex);
gl.glEndList();

gl.glNewList(displayList[2], GL_COMPILE);
wald.drawForest2DObjects(gl,glu,null,texture,treeT ex);
gl.glEndList();

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

HamsterofDeath
12-26-2002, 01:54 PM
sorry, wrong topic name...

dorbie
12-26-2002, 02:18 PM
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);

glCallList(display_base+n);

and dispense with the array.

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

HamsterofDeath
12-27-2002, 03:45 AM
i'm using java+gl4java, so it's not useless for me

dorbie
12-28-2002, 03:01 PM
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.

Deiussum
12-29-2002, 03:49 PM
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.

dorbie
12-29-2002, 04:40 PM
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.

HamsterofDeath
12-30-2002, 09:05 AM
some other display-list-questions :
- are quads converted into small triangle-strips ?
- are displaylists stored in the graphic cards ram ?

HamsterofDeath
12-31-2002, 02:29 AM
is there a limit for display lists ? (maximum number of lists or maximum number of commands)

Deiussum
12-31-2002, 05:35 AM
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.