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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:16:10+00:00 2026-05-13T10:16:10+00:00

I’m trying to create an offscreen render buffer in OpenGL ES on the iPhone.

  • 0

I’m trying to create an offscreen render buffer in OpenGL ES on the iPhone. I’ve created the buffer like this:

        glGenFramebuffersOES(1, &offscreenFramebuffer);
    glBindFramebufferOES(GL_FRAMEBUFFER_OES, offscreenFramebuffer);

    glGenRenderbuffersOES(1, &offscreenRenderbuffer);
    glBindRenderbufferOES(GL_RENDERBUFFER_OES, offscreenRenderbuffer);
    glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, offscreenRenderbuffer);

But I’m confused on how to render the storage. Apple’s documentation says to use the EAGLContext renderBufferStorage:fromDrawable: method, but this seems to only work for one render buffer (the main one being displayed). If I use the normal OpenGL function glRenderBufferStorageOES, then I can’t seem to get it to display. Here’s the code:

        // this is in the initialization section:
    glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_RGB8_OES, backingWidth, backingHeight);

    // and this is when I'm trying to draw to it and display it:
    glBindFramebufferOES(GL_FRAMEBUFFER_OES, offscreenFramebuffer);
    GLfloat vc[] = {
        0.0f, 0.0f, 0.0f,
        10.0f, 10.0f, 10.0f,
        0.0f, 0.0f, 0.0f,
        -10.0f, -10.0f, -10.0f,         
    };

    glLoadIdentity();
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(3, GL_FLOAT, 0, vc);
    glDrawArrays(GL_LINES, 0, 4);
    glDisableClientState(GL_VERTEX_ARRAY);

    glBindRenderbufferOES(GL_RENDERBUFFER_OES, offscreenRenderbuffer);
    [context presentRenderbuffer:GL_RENDERBUFFER_OES];

Doing it this way, nothing is displayed on the screen. However, if I switch out the references to “offscreen…Buffer” to the buffers that were created with the renderBufferStorage method, it works fine.

Any suggestions?

  • 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-13T10:16:10+00:00Added an answer on May 13, 2026 at 10:16 am

    @david good idea.. what you need to do is what @prideout said.. create a texture and render to it.. and use the texture on a quad every time. Make sure you draw to the texture only once, as in your case things are persistent.

    - (void)setUpTextureBuffer 
    {
     glGenFramebuffersOES(1, &texturebuffer); 
     glBindFramebufferOES(GL_FRAMEBUFFER_OES, texturebuffer);
    
     // create the texture
     glGenTextures(1, &canvastexture); 
     glBindTexture(GL_TEXTURE_2D, canvastexture); 
     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,  512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); 
     glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, canvastexture, 0);
    
     GLenum status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); 
     if(status != GL_FRAMEBUFFER_COMPLETE_OES) { 
      NSLog(@"failed to make complete framebuffer object %x", status);
     }
    
     glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
     glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
    
     glClearColor(1.0, 1.0, 1.0, 1.0);
     glViewport(0, 0, 512, 512);
     glClear(GL_COLOR_BUFFER_BIT);
    }
    
    
    
    //setTargetToTexture() function
    
     glBindFramebufferOES(GL_FRAMEBUFFER_OES, tbuffer);
     glBindTexture(GL_TEXTURE_2D, allbrushes);
     glViewport(0, 0, 512, 512);
    
    //reset pointers after finishing drawing to textures
    
     glViewport(0, 0, BWIDTH, BHEIGHT);
     glVertexPointer(2, GL_FLOAT, 0, canvas);   //canvas vertices
     glTexCoordPointer(2, GL_FLOAT, 0, texels);
     glBindTexture(GL_TEXTURE_2D, boundtexture);   //bind to the texture which is the special render target 
     glBindFramebufferOES(GL_FRAMEBUFFER_OES, fbuffer); //back to normal framebuffer
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm trying to create an if statement in PHP that prevents a single post
I have some data like this: 1 2 3 4 5 9 2 6
I am trying to understand how to use SyndicationItem to display feed which is
I would like to count the length of a string with PHP. The string

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.