开发者

Single threaded OpenGL ES Android application

I'm trying to create single threaded OpenGL application for Android like in this example.

But when I added onTouchEvent, onKeyDown and onKeyUp methods in the activity class, application starts to work very slowly.

Als开发者_如何学运维o I tried to add sleep(20) into the onDraw method, but it didn't help.

Please, tell, how I should to organise my single threaded OpenGL app?


You will find that when you listen for a touch event you will start getting them very rapidly with multiple events per touch. Each of these events will stop any rendering and call your listener's code which will make your rendering appear slow.

You've reached a limitation of having a single threaded renderer here, and the next step would be to use another thread for the rendering.

For now, rather than sleeping inside your onDraw method, try sleeping in your event handler.

Read this question and the linked post by Dianne Hackbourn.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜