如何解决性能问题与Buffer.put()和Android的OpenGL [英] How to get around the performance issues with Buffer.put() and Android OpenGL

查看:146
本文介绍了如何解决性能问题与Buffer.put()和Android的OpenGL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个Java问题,在一般情况下,尽管在这种特殊情况下我使用的顶点数组在Android中的OpenGL。要使用这个基本总帐系统,必须使用Java的缓冲系统,本机的分配模式。这是Java很慢。而我的整个应用程序的时间大约40-50%的内部buffer.put花()。

It is a Java issue in general, though in this particular case I am using Vertex Arrays in Android for OpenGL. To use this basic GL system, you must use Java's Buffer system in native allocation mode. This is very slow on Java. And roughly 40-50% of my entire application's time is spent inside of buffer.put().

有没有什么办法可以加快这,而留在Java中(即不使用原生SDK)?

Is there any way to speed this up while staying in Java (ie, don't use the native sdk)?

推荐答案

避免在一般的分配。使用缓冲池,并根据需要兼顾他们周围。你可以有几个标准尺寸和换取性能浪费在最后几个字节。此外,使用OpenGL的时候,你通常不需要重写你的缓冲区每一帧(除非你做大量的蒙皮或动画?)。通常情况下,你有你的pre出炉的阵列,利用变换矩阵的对象,仅此而已。

Avoid allocations in general. Use a pool of buffers and juggle them around as needed. You can have a few standard sizes and waste a few bytes at the end in exchange for performance. Also, when using OpenGL you typically don't need to rewrite your buffers every frame (unless you do extensive skinning or animation?). Normally, you have your pre-baked arrays, transform objects using matrices, and that's it.

这篇关于如何解决性能问题与Buffer.put()和Android的OpenGL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆