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

  • Home
  • SEARCH
  • 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 67869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:19:39+00:00 2026-05-10T19:19:39+00:00

I have an iphone app where I call these three functions in appDidFinishLaunching: glMatrixMode(GL_PROJECTION);

  • 0

I have an iphone app where I call these three functions in appDidFinishLaunching:

glMatrixMode(GL_PROJECTION); glOrthof(0, rect.size.width, 0, rect.size.height, -1, 1); glMatrixMode(GL_MODELVIEW); 

When stepping through with the debugger I get EXC BAD ACCESS when I execute the first line. Any ideas why this is happening?

Btw I have another application where I do the same thing and it works fine. So I’ve tried to duplicate everything in that app (#imports, adding OpenGLES framework, etc) but now I’m just stuck.

  • 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. 2026-05-10T19:19:39+00:00Added an answer on May 10, 2026 at 7:19 pm

    I’ve run into this with OpenGL calls if two threads are attempting to draw to the OpenGL scene at once. However, that doesn’t sound like what you’re doing.

    Have you properly initialized your display context and framebuffer before this call? For example, in my UIView subclass that does OpenGL drawing, I call the following in its initWithCoder: method:

    context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];  if (!context || ![EAGLContext setCurrentContext:context] || ![self createFramebuffer])  {     [self release];     return nil; } 

    The createFramebuffer method looks like the following:

    - (BOOL)createFramebuffer  {        glGenFramebuffersOES(1, &viewFramebuffer);     glGenRenderbuffersOES(1, &viewRenderbuffer);      glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);     glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);     [context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)self.layer];     glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer);      glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);     glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);      if (USE_DEPTH_BUFFER) {         glGenRenderbuffersOES(1, &depthRenderbuffer);         glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);         glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);         glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer);     }      if(glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES)      {         return NO;     }      return YES; } 

    This is pretty much boilerplate code, as generated by the OpenGL ES Application template in XCode. Perhaps by not initializing things before calling glMatrixMode(), you’re getting a crash.

    Also, why are you doing OpenGL drawing in applicationDidFinishLaunching:? Wouldn’t a view or view controller be a more appropriate place for OpenGL calls than your UIApplicationDelegate?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You need to synchronize your threads on a monitor. For… May 11, 2026 at 3:20 pm
  • added an answer Then just use Doxygen? This will get you started: This… May 11, 2026 at 3:20 pm
  • added an answer There's really no need to rename it. Simply merge or… May 11, 2026 at 3:20 pm

Related Questions

I'm trying to work out the correct way to handle populating an array with
My app needs to play some audio files and I want to fade-out the
I've been doing mobile app development for a long time (2001?), but the systems
I have an iPhone app that compiles and runs fine in the Simulator on

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.