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 6568639
In Process

The Archive Base Latest Questions

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

I have this problem with openGL ES 1.1 on iPhone. I have made myself

  • 0

I have this problem with openGL ES 1.1 on iPhone. I have made myself c++ engine that makes all the job in opengl and a view that shows the rendered content. The problem is that sometimes it works ok and sometimes (most of the times) it shows messed up view. By messed up i mean that objects that do not move appear in different locations, rotated, stretched, o ther parts of the scene is okay or invisible, there is no user interacion nor FPS (its just one frame when it breaks up). I thought it may be because my depth buffer is shitty. But i think that the overall buffer engines may be bad. Anyways these are the parts from my code.

I have view, that initializes like this:

 self = [super initWithFrame:frame];
if (self) {
    CAEAGLLayer* eaglLayer = (CAEAGLLayer*) super.layer;
    eaglLayer.opaque = YES;
    
    
    m_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
    
    if (!m_context || ![EAGLContext setCurrentContext:m_context]) {
        [self release];
        return nil;
    }
    
    cplusplusEngine = CreateRenderer();
    
    [m_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:eaglLayer];
    
    cplusplusEngine ->Initialize(CGRectGetWidth(frame), CGRectGetHeight(frame));
    
    //[self drawView: nil];
    //m_timestamp = CACurrentMediaTime();
    
    CADisplayLink* displayLink;
    displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(drawView:)];
    [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
    [displayLink setFrameInterval:1/45];
    
    [self loadUpTextures];

}

return self;

the draw View method looks like this:

GLint a = cplusplusengine->Render();

[m_context presentRenderbuffer:GL_RENDERBUFFER_OES];

now i create the buffer and present it, i also create buffers in engine like this:

 int widthB, heightB;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,GL_RENDERBUFFER_WIDTH_OES, &widthB); 
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,GL_RENDERBUFFER_HEIGHT_OES, &heightB); glViewport(0, 0, widthB, heightB);
// Create a depth buffer that has the same size as the color buffer.
glGenRenderbuffersOES(1, &m_depthRenderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_depthRenderbuffer);
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, widthB, heightB);
// Create the framebuffer object. 
GLuint framebuffer;
glGenFramebuffersOES(1, &framebuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, framebuffer); 
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, m_colorRenderbuffer);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES,GL_RENDERBUFFER_OES,m_depthRenderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_colorRenderbuffer);

And every frame i clear color and depth buffers. Now i do get message from instruments for that draw view’s line "present renderbuffer" it says "OpenGL ES performed an unnecessary logical buffer store operation. This is typically caused by not clearing buffers at the start of the rendering loop and not discarding buffers at the end of the rendering loop. If your application clears the depth buffer at the beginning of each frame, it should discard the depth buffer at the end of each frame. Please see the EXT_discard_framebuffer extension for more details." Now i am trying to work my a** off to solve this but i cannot find the solution. I may have few places in textures where this may be happening. It would be helpful to at least find out why opengl may draw messy.

P.S. I do load up textures in that view and set them in engine like this. engineTexture[index] = viewsTextureValueAt[index]; That just sets the GLuint from views texture pointer to engine texture pointer. Can i do that? It works but i don’t know whether this is the case. I do get errors even if i comment out all the texture usages though.

  • 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-25T14:30:15+00:00Added an answer on May 25, 2026 at 2:30 pm

    I managed to work this out myself. It seems my buffers are all okay. My textures are also good. The error was lying in one simple "common newbie mistake". I used quite few variables to manipulate and align all my scene. It seems that when I was using those variables in objective-c without first defining the values to zero it was okay, the compiler somehow assigned 0 to them, but now, when I use c++ engine, all variables that I did not define now gets random values, this makes my application randomly crash up in different ways. For example my button alignment array was set only for last 4 buttons, first one is in 0 position so I left that number undefined so that’s why that button flew off somewhere every time I launched. One time the value got 1700000+ another -0.000056+ and so.

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

Sidebar

Related Questions

I am programming an OpenGL game for the iPhone, and have this code that
I'm learning OpenGL from this tutorial: http://openglbook.com/the-book/ . I have problem with shaders. I'm
I have this problem that drives me mad, so I am here to ask
I have this problem: Well, the words in the article are ClickableSpans that change
Right now, I'm playing with OpenGL ES on the iPhone using Oolong Engine. This
Has anyone come across this problem when building with cocos2d (OpenGL library for iPhone
I have an iPhone app that hides the status bar. However, my main view
I have an OpenGL Live wallpaper that works fine on all phones except those
The problem is that this code display nothing. I have problem with my loads
I have this problem I can't figure out, I query the DB this way:

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.