Question

Is there possibility to get array of vertices stored within display list in opengl? From some other code I get a display list which I should draw , but I need to know a bounding box of that model. Is there a possibility that I could extract that information from display list?

Was it helpful?

Solution

Have you considered using the feedback buffer, since this is deprecated OpenGL?

You can set the render mode to GL_FEEDBACK before drawing your display list and then get a buffer full of all the vertices. Since this is a rarely used feature and a deprecated one at that (transform feedback is the modern equivalent, though it functions in a different pipeline stage), some language bindings may not have it.

Unfortunately, the feedback buffer contains more than just vertices. It contains a list of all the raster operations that occurred, and you would have to build some software to make sense of this list. The OpenGL SuperBible has an example of how to do this in C.

The other thing to note is that vertex positions are in screen space, you will need to reverse project them into object space for this to work the way you want in your example. This also means that the original positions for any vertices that had to be clipped will be lost. It is far from a perfect solution, more of a hack if anything, but it could be useful.

OTHER TIPS

No. The GL has no support for inspecting display lists. DLs are just for the GL, not for the user.

Having said that, there is still a theoretical possibility to get the contents of the DL. You could intercept all GL calls the code generating the DL is calling, track dlist state and compute the bounding boxes based on the vertex data. The old chromium open source project would in principle allow you to do this. However, the effort for this would be extraordinarily high, and I doubt that it would be a viable solution to your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top