reading data back from VBO on iPhone
My app writes all of my geometry data to VBO's for performance, but I n开发者_运维知识库eed to read the vertex data during the program execution for ray triangle intersection testing. I noticed that there is a function that is supposed to map to the location of the VBO data, glMapBufferOES, but it looks like it only supports GL_READ_ONLY. Does anyone know of a way to read back VBO data on the iPhone once it's bound?
Save the filename so that you can load the vertices in from the file when you need it, do your testing, and then clear it again. This is along the lines of what Apple instructs you to do as much as you can when it comes to developing for iOS devices. The storage is surprisingly fast.
I figured out how to do this. Since I'm not doing this every frame, I just read the vertices for the model I selected back from the file that I originally read in, perform ray triangle intersection testing, then clear the vertex array again. On small models the delay is imperceptible. On 1 million polygons, there is a half second delay, which is acceptable for my purposes.
精彩评论