Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 717383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:24:25+00:00 2026-05-14T05:24:25+00:00

I’ve been struggling with this for a while now, and this code crashes with,

  • 0

I’ve been struggling with this for a while now, and this code crashes with, to me, unknown reasons. I’m creating an FBO, binding a texture, and then the very first glDrawArrays() crashes with a “EXC_BAD_ACCESS” on my iPhone Simulator.

Here’s the code I use to create the FBO (and bind texture and…)

glGenFramebuffers(1, &lastFrameBuffer);
glGenRenderbuffers(1, &lastFrameDepthBuffer);
glGenTextures(1, &lastFrameTexture);

glBindTexture(GL_TEXTURE1, lastFrameTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 768, 1029, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_6_5, NULL);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

//Bind/alloc depthbuf
glBindRenderbuffer(GL_RENDERBUFFER, lastFrameDepthBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 768, 1029);

glBindFramebuffer(GL_FRAMEBUFFER, lastFrameBuffer);

//binding the texture to the FBO :D
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, lastFrameTexture, 0);

// attach the renderbuffer to depth attachment point
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, lastFrameDepthBuffer);

[self checkFramebufferStatus];

As you can see this takes part in an object, checkFrameBufferStatus looks like this:

GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
switch(status)
{
  case GL_FRAMEBUFFER_COMPLETE:
    JNLogString(@"Framebuffer complete.");
    return TRUE;

  case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
    JNLogString(@"[ERROR] Framebuffer incomplete: Attachment is NOT complete.");
    return false;

  case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
    JNLogString(@"[ERROR] Framebuffer incomplete: No image is attached to FBO.");
    return false;

  case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
    JNLogString(@"[ERROR] Framebuffer incomplete: Attached images have different dimensions.");
    return false;

  case GL_FRAMEBUFFER_UNSUPPORTED:
    JNLogString(@"[ERROR] Unsupported by FBO implementation.");
    return false;

   default:
    JNLogString(@"[ERROR] Unknown error.");
    return false;

JNLogString is just an NSLog, and in this case it gives me:

2010-04-03 02:46:54.854 Bubbleeh[6634:207] ES2Renderer.m:372 [ERROR] Unknown error.

When I call it right there.

So, it crashes, and diagnostic tells me there’s an unknown error and I’m kinda stuck. I basically copied the code from the OpenGL ES 2.0 Programming Guide…

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:24:25+00:00Added an answer on May 14, 2026 at 5:24 am
            glBindTexture(GL_TEXTURE1, lastFrameTexture);
    

    That’s not allowed, I was trying to bind the texture to unit one (GL_TEXTURE1), but that should be done by glActiveTexture(), not by glBindTexture(), which wants to know the type of the texture (GL_TEXTURE_2D, GL_TEXTURE_3D, etc.) not the texture unit. To place a texture in texture unit 1 I now have the following code which I think is correct:

    //Bind 2D Texture lastFrameTexture to texture unit 1
    glActiveTexture(GL_TEXTURE1);
    glBindTexture(GL_TEXTURE_2D, lastFrameTexture);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 371k
  • Answers 371k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I don't think the use of Python helps all that… May 14, 2026 at 7:06 pm
  • Editorial Team
    Editorial Team added an answer I researched treemapping and packing problems. .... and eventually decided… May 14, 2026 at 7:06 pm
  • Editorial Team
    Editorial Team added an answer System.DirectoryServices.Protocols namespace contains various generic LDAP classes e.g. System.DirectoryServices.Protocols.LdapConnection May 14, 2026 at 7:06 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.