调试OpenGL的最好方法是什么? [英] What is the best way to debug OpenGL?

查看:350
本文介绍了调试OpenGL的最好方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现很多时候,OpenGL会通过没有绘制任何东西来告诉你失败。我试图找到方法来调试OpenGL程序,检查转换矩阵堆栈等等。调试OpenGL的最好方法是什么?如果代码看起来像感觉顶点在正确的位置,那么你怎么能确定它们呢?

I find that a lot of the time, OpenGL will show you it failed by not drawing anything. I'm trying to find ways to debug OpenGL programs, by inspecting the transformation matrix stack and so on. What is the best way to debug OpenGL? If the code looks and feels like the vertices are in the right place, how can you be sure they are?

推荐答案

不直接回答这一切都取决于你想要理解的内容。由于OpenGL是状态机,有时候它不会按照你所期望的那样做,因为没有设置状态或者这样的东西。

There is not straight answer. It all depends on what you are trying to understand. Since OpenGL is state machine, sometime it does not do what you expect as required state is not set or things like that.

一般来说,使用像glTrace / glIntercept看看OpenGL调用跟踪),gDebugger(可视化纹理,着色器,OGL状态等)和纸张/铅笔:)。有时,它有助于了解你如何设置摄像头,它正在寻找什么,被剪辑的等等。我个人依靠比以前的两个方法。但是,当我可以认为这个深度是错误的,那么它有助于看痕迹。 gDebugger也是只能使用的工具,可以有效地用于剖析和优化OpenGL应用程序。

In general, use tools like glTrace / glIntercept (to look at OpenGL call trace), gDebugger (to visualize textures, shaders, OGL state etc.) and paper/pencil :). Sometimes it helps to understand how you have setup camera and where it is looking, what is being clipped etc. I have personally relied to last more than previous two approaches. But when I can argue that depth is wrong then it helps to look at trace. gDebugger is also the only tool that can be used effectively for profiling and optimization your OpenGL app.

除了这个工具,大部分时间这是数学的人们错了,它不能被理解使用任何工具。发表在OpenGL.org newgroup上的代码特定评论,你永远不会失望。

Apart from this tool, most of the time it is the math that people get it wrong and it can't be understood using any tool. Post on OpenGL.org newgroup for code specific comments, you will be never disappointed.

希望这回答你的问题!

这篇关于调试OpenGL的最好方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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