Android:如何调试 OpenGL-ES 应用程序
我的问题看起来真的很愚蠢。但这个问题我真的很头疼。例如,您使用 canvas
在屏幕上绘制某些内容(例如:直线、正方形),您只需一行代码。因此,在调试时,当您浏览该行并得到不好的结果(什么也没发生,没有绘制您想要的内容,...)您完全知道该行或其方法的参数有问题。
但是当我来到OpenGL时,只是一个三角形(带有颜色纹理,...),你必须使用“多行代码”:创建byteBuffer
,转换为floatBuffer
,启用您将使用的某些状态...并且在调试时,出现问题,我不知道为什么(可能是错误的参数,或者我丢失了某些东西,...)。调试器只是帮助我查看代码流并了解它是如何工作的。
我需要这里人们的一些建议来克服这个问题。请帮我。
谢谢 :)
My question seems really silly. But I really headache with this question. For example you use canvas
to draw something on Screen (example: line, square) You just take one line of code. So, when debug, when you go through that line, and bad result ( nothing happened, not draw what you want,...) You totally know that something wrong with that line or parameter of its method.
But when I come to OpenGL, just a triangle (with color texture,...), you must use "many line of code" : create byteBuffer
, convert to floatBuffer
, enable some state that you will use... And when debug, something wrong, I cannot know why (It can be wrong parameter, or I missing something,...). Debugger just help me view flow-of-code and see how it work.
I need some advice of people here to overcome this. Please help me.
thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
实际上,有一个名为 Tracer for OpenGL ES 的 Eclipse 工具
Actually, there is an Eclipse tool called Tracer for OpenGL ES
我要做的第一件事是查看 Logcat 输出。查找来自您的应用程序的错误。
要在 Eclipse 中查看 Logcat 输出,请找到 DDMS 视图。
否则,您可以访问:
窗口>显示视图>其他
然后展开Android,然后选择Logcat
The first thing I would do is look at Logcat output. Look for errors coming from your app.
To see Logcat output in Eclipse, find the DDMS view.
Otherwise, you can go to:
Window > Show View > Other
Then expand Android and then select Logcat
除了 LogCat 和跟踪之外,除了尝试了解每行代码的作用的细粒度细节之外,您实际上无能为力。你的问题很开放,你有遇到过的问题的具体例子吗?无论如何,当我第一次使用时,我发现这个网站是一个很好的学习资源开始学习OpenGL ES。
然而,对于游戏开发,我倾向于使用围绕 OpenGL ES 的开源框架,如 libgdx 或 AndEngine(用于游戏)。
Other than LogCat and tracing, there really isn't much more you can do other than trying to understand the fine grain details of what each line of the code does. Your question is quite open-ended, do you have a specific example of a problem that you ran into? Anyhow, I found this site as a good learning resource when I first started learning about OpenGL ES.
However, for game development,I tend to lean towards using open source frameworks that wraps around OpenGL ES like libgdx or AndEngine (for games).