Example from Chapter 1 of iphone 3D programming book not drawing to screen.

£可爱£侵袭症+ 提交于 2019-12-11 05:22:11

问题


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.

Thanks so much!


回答1:


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);

this renders just fine.

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.



来源:https://stackoverflow.com/questions/4034182/example-from-chapter-1-of-iphone-3d-programming-book-not-drawing-to-screen

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!