Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

ios - ipad 3 - openGL bug with kEAGLDrawablePropertyRetainedBacking and retina?

i have an iOS openGL app which uses the kEAGLDrawablePropertyRetainedBacking property to draw the current frame on top of the previous frame. it's a cheap way of getting effects like motion trails.

it works great on all devices (including iPhone w/ retina) and all device simulators, but on the actual iPad 3 device, the previous frame is vertically squished to 75% of its previous size.

for example, if i were to draw a 100 x 100 square at the bottom of the screen each frame, then in frame 0 i have one square, in frame 2 there's an echo that's 100 x 75 and offset towards the top of the screen, in frame three there's an additional echo that's 100 x 56 (56 ~= 75 * 0.75) and is more offset towards the top, and so-on. what should happen is that all the echoes remain in place.

i've verified the behavior on two devices, so i don't think it's a just a broken iPad.

any ideas ?

tia, orion

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I was seeing this bug. I don’t know anything about OpenGL, so I couldn’t really dig into solving it with textures, as has been suggested, but in my case I was able to switch to a very fast implementation of Quartz 2D drawing based on a tutorial from http://blog.effectiveui.com/?p=8105, plus how to make it work on Retina from https://stackoverflow.com/a/10870188/255489. It actually ended up being much faster than the code I had borrowed from Apple’s GLPaint sample code.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...