Question

So I have a bunch of addresses for my display lists. I can do those and get those on the screen with GL11.glCallList(address) easily enough. My problem is that I don't know how to use the potentially more efficient GL11.glCallLists(something) to call a bunch of lists with one native call. I've tried creating an IntBuffer with IntBuffer ib = ByteBuffer.allocateDirect(numberOfDisplayLists * 4).asIntBuffer() and then put(int index, int i)ing the correct values into the IntBuffer, but when I call GL11.glCallLists(ib) nothing happens.

Help?

Was it helpful?

Solution

Here's one way of doing it...

static int size = 10;
int compiledList;
IntBuffer lists;

lists = BufferUtils.createIntBuffer(size);
compiledList = GL11.glGenLists(size);

for (int i = 0; i < size; i++) {
    GL11.glNewList(compiledList + i, GL11.GL_COMPILE);
    ...render here...
    GL11.glEndList();
    lists.put(offset);
}
lists.flip();

GL11.glListBase(compiledList);
GL11.glCallLists(lists);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top