iPhone 3D编程手册第1章中的示例未绘制到屏幕上. [英] Example from Chapter 1 of iphone 3D programming book not drawing to screen.

查看:118
本文介绍了iPhone 3D编程手册第1章中的示例未绘制到屏幕上.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用针对iPhone的3D编程(O'Reilly)学习OpenGL-ES.它的第一个教程涉及将屏幕背景绘制为灰色.我已经输入了字母的所有代码,它运行无误,但是我没有颜色...只是黑色.由于运行正常,因此没有错误消息.

I'm learning OpenGL-ES with 3D programming for the iPhone (O'Reilly). Its first tutorial involves drawing the background of the screen grey. I've entered in all the code to the letter and it runs without error, but I get no color...just black. Since it runs fine, there is no bug message.

有一些非常小的源文件,然后在此处发布所有代码,我将项目压缩并提供给在此处下载.我不知道要求别人看看是否太多,但是我真的很想看看那些执行顺利但没有输出的代码.

There are a few very small source files and rather then post all the code here I've zipped up the project and made it available for download here. I don't know if it is too much to ask for people to look at, but I'm really pulling my hair out looking at code that executes without a hitch, but has no output.

请告知我是否可以帮助您深入了解此问题.

Please let me know if I can be of any help to get to the bottom of this issue.

非常感谢!

推荐答案

问题是您试图将渲染缓冲区创建为帧缓冲区.如果您转到GLView的-initWithFrame:方法并更改相应的行以读取

The problem is that you are trying to create your renderbuffer as a framebuffer. If you go to GLView's -initWithFrame: method and change the appropriate lines to read

glGenRenderbuffersOES(1, &renderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, renderbuffer);

这很好.

您确定这是本书中的代码吗?它与我面前的版本不匹配.作者在书本中正确配置了渲染缓冲区.

Are you sure this is the code from the book? It doesn't match what I have in the version in front of me. The author properly configures the renderbuffer in the book text.

这篇关于iPhone 3D编程手册第1章中的示例未绘制到屏幕上.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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