开发者

How to avoid cropping of the display in OpenGL on the iPhone

开发者 https://www.devze.com 2023-03-03 02:50 出处:网络
This has been a long term issue I need your collective genius to solve. I am taking images from the camera and outputting them to opengl. Recording the images via an off screen FBO outputs correctly.

This has been a long term issue I need your collective genius to solve. I am taking images from the camera and outputting them to opengl. Recording the images via an off screen FBO outputs correctly.

However, what I output to display on screen is always cropped/zoomed in on the top right corner. (For instance, if I take a photo of a four-pane window, the image saved from the off screen buffer will sho开发者_如何学运维w the entire window, but what is live on screen is just the top left pane.)

I have tried changing glviewport as well as multiplying my vertex data to no avail. The only thing that seems to work is by setting the eagllayer's contentScaleFactor to a value of 1.4 or above. What this hack essentially does is increase the FBO's by 1.4x I think, which is no good for performance. Any ideas how I can properly output to the screen, without using this hack? It must be something very simple that I've just not found. Thanks, everyone.


Funny how just posting to stackoverflow often solves my problems. Turns out the backing width and height were being set up wrong due to glGenFramebuffers being called twice. Fixing that allowed glviewport (set to the display width and height) to work.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号