![]() |
|
Render to texture failing - Printable Version +- iDevGames Forums (http://www.idevgames.com/forums) +-- Forum: Development Zone (/forum-3.html) +--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html) +--- Thread: Render to texture failing (/thread-8054.html) |
Render to texture failing - headkaze - Aug 31, 2010 09:58 PM I am trying to setup a FBO so I can render to a texture. It works fine in simulator but fails on iPhone 3G with the message "failed to make complete framebuffer object 8cd6". The error code is GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES. Here is the code Code: GLuint framebuffer;I've followed the way it's done on Apple's website topic Using Framebuffer Objects to Render to a Texture. I have researched this for hours now and cannot figure out why it's failing. RE: Render to texture failing - headkaze - Aug 31, 2010 11:58 PM Even putting this code into a blank OpenGL ES template in XCode it fails on the 3G (running iOS 4.0.1). Can someone please help? RE: Render to texture failing - mariocaprino - Sep 1, 2010 12:23 AM Having a quick look through your code I believe you can't create a Non-Power-Of-Two textures on the iPhone. Try putting a glGetError() after your glTexImage2D() to test if it fails. There might be other errors but hopefully that will give you a head start. RE: Render to texture failing - headkaze - Sep 1, 2010 12:32 AM Oh wow, what an idiot I am. Thankyou so much mariocaprino that was it. I can't believe I have spent so much time trying to figure this out! RE: Render to texture failing - arekkusu - Sep 1, 2010 01:15 AM More specifically, you can't create NPOT textures on MBX devices. You can on SGX. RE: Render to texture failing - headkaze - Sep 1, 2010 01:44 AM How can I check if I need to make the texture POT? Any glGetIntegerv() I can check? Another problem I've encountered is when I switch back to my normal rendering the depth buffer is no longer working. I have this code Code: if(m_textureRenderer->IsActive())If I don't active the texture rendering then it renders fine, it's only when I go to texture rendering then back again that the depth buffer no longer works. Looks like all I need is Code: if(m_textureRenderer->IsActive())And to restore the default depth buffer Code: glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_depthRenderbuffer);RE: Render to texture failing - arekkusu - Sep 1, 2010 08:23 PM (Sep 1, 2010 01:44 AM)headkaze Wrote: How can I check if I need to make the texture POT? Check for the APPLE_texture_2D_limited_npot extension, as listed in the platform notes. Quote:I have this code What are you expecting glBindRenderbuffer to do here? RE: Render to texture failing - headkaze - Sep 1, 2010 09:47 PM (Sep 1, 2010 08:23 PM)arekkusu Wrote: What are you expecting glBindRenderbuffer to do here? I replied to my own post which seems to add to the previous post with a HR between them. What I wanted to do was switch my game from rendering to the screen to a texture (for a transition) then back again. I've already figured it out, I just had to add the glFramebufferRenderbufferOES call instead of just binding it otherwise the depth buffer does not work. |