帧缓冲区对象问题
您好,我正在为 iPhone 使用 OpenGLES 进行编程,但目前遇到了一个奇怪的帧缓冲区对象错误。
起初我遵循 Simon Maurice 的一些教程: http://web.me.com/smaurice/AppleCoder/Welcome.html
但后来我在继续其他教程之前继续做了一些自己的实验,但是我的实验遇到了问题。我试图做的是使 EAGLView 成为 ViewController 的视图,当基本代码最初来自教程时,这工作得非常好。
由于 EAGLView 是 UIView 的子类,因此执行此操作并不太难,因此继续进行实验,我想从头开始执行此操作。我在 Xcode 中使用基于 Windows 的应用程序项目创建了一个新项目,并创建了一个新的 EAGLView 和 ViewController 来执行与上一个项目相同的任务。
然而,编译并运行后,视图显示为白色,并且控制台在 createFramebuffer 过程中输出“无法制作完整的帧缓冲区对象 %x”错误。 (错误控制台输出:“GLController[2071:207] 未能创建完整的帧缓冲区对象 0”)。
我首先以为这是我的代码,所以我将前一个项目的工作代码复制到新项目中,但仍然收到相同的错误。同时,我将新项目代码移至旧项目中并编译成功。
我很困惑为什么相同的代码在新项目中无法正常工作,但新代码在旧项目中却可以正常工作。如果有人知道我缺少什么,我将不胜感激。
谢谢。
(还使用 Apple 示例代码中的多个 EAGLView 进行了测试,在新项目上发生了相同的错误,但在附加了 ViewController 的旧项目上不会发生。)
Hello I'm programming in OpenGLES for the iPhone but I'm currently stuck with a strange framebuffer object error.
At first I was following a few tutorials from Simon Maurice:
http://web.me.com/smaurice/AppleCoder/Welcome.html
But then I moved on to do a few experiments of my own before continuing with other tutorials, however my experiment has hit a problem. What I was trying to do was make the EAGLView the view of a ViewController and this worked perfectly fine when the base code was originally from the tutorials.
Since EAGLView is a subclass of the UIView it's not too hard to do this, so continuing on with the experiment I wanted to do it with a clean slate. I created a new project in Xcode with the Windows-based Application project and created a new EAGLView and a ViewController to do the same task as the previous project.
However after compiling and running the view comes up white and the console outputs the "failed to make complete framebuffer object %x" error during the createFramebuffer process.
(Error console output: "GLController[2071:207] failed to make complete framebuffer object 0").
I first thought it was my code so I ripped the working code from the previous project into the new project and still receive the same errors. At the same time I moved the new projects code into the old project and compiled with a successful output.
I'm confused to why the same code won't work correctly in a new project yet the new code will work correctly in the old project. If someone knows what I am missing it would be greatly appreciated.
Thanks.
(Also tested with several EAGLViews from Apple sample codes and the same error occurs on the new project, but does not occur on the old project with a ViewController attached.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这里在黑暗中拍摄,缺乏关于您所做的事情的更多信息,但是...您是通过 IB 实例化您的 EAGLView (从而通过
-initWithCoder:
),还是以编程方式(-initWithFrame:
)?如果您查看 EAGLView.m,您会发现只有
-initWithCoder:
执行了实际所需的初始化。将该初始化代码迁移到共享(或仅限-initWithFrame:
)初始化程序非常容易。Shot in the dark here, lacking more info about what you've done, but...are you instantiating your EAGLView via IB (and thus going through
-initWithCoder:
), or programmatically (-initWithFrame:
)?If you look at EAGLView.m, you'll see that only
-initWithCoder:
does the actual initialization required. It is very easy to migrate that initialization code to a shared (or-initWithFrame:
only) initializer.当尝试将 EAGLView 设置为 viewController 的视图时,我遇到了类似的问题。相反,将 viewController 的 view 属性附加到标准 UIView。然后,当视图成功加载时(可能在 viewController 的 viewDidLoad 方法中),实例化 EAGLView 并将其作为子视图添加到 viewController.view。
I've run into a similar problem when trying to set an EAGLView as the view of a viewController. Instead, attach the viewController's view property to a standard UIView. Then, later on, when the view has successfully loaded (perhaps in the viewController's viewDidLoad method), instantiate an EAGLView and add it as a subview to viewController.view.
opengles 模板程序从上一版 Iphone SDK 到当前版本有所变化。 有编写用于在 ES2.0 和 ES1.1 之间进行选择的支持代码。
请注意,
there has been a change in opengles template program from the last Iphone SDK to the current one. There is support code written for choosing between ES2.0 and ES1.1
please note that.