OPENGL/ES 3D model zoomed doesn't pan correctly in UIScrollView

两盒软妹~` 提交于 2019-12-11 15:59:54

问题


I have a 3d model rendered in a UIView. When I pinch the model it zooms correctly, but when zoomed in I'd like the ability to pan/scroll the view so that I can see the parts of the model which are outside the boundaries of the view. I switched the UIView to a UIScrollView, and on the pinch event is update the content size with the scale factor. This works great and I can now scroll the view. My problem is that panning to the outer edges of the content view still shows the 3d model still clipped at the size of the initial view. I hope this makes sense...

Does anyone have an idea what might be needed to render the zoomed in parts of the chair, which should now be visible (after panning)?


回答1:


I was able to get this working after setting the UIView.bounds as well as the UIScrollView content size. That is, the scrollview contained a uiview, which contained the 3d model. I was resizing the scrollview, but not the uiview. They both needed to be set in order for this to work.



来源:https://stackoverflow.com/questions/4820156/opengl-es-3d-model-zoomed-doesnt-pan-correctly-in-uiscrollview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!