lwjgl: How can I use glCallLists?
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?
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);
精彩评论