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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:42:16+00:00 2026-06-05T05:42:16+00:00

I am working with the following architecture: OpenGL ES 2 on iOS Two EAGL

  • 0

I am working with the following architecture:

  • OpenGL ES 2 on iOS
  • Two EAGL contexts with the same ShareGroup
  • Two threads (server, client = main thread); the server renders stuff to textures, the client displays the textures using simple textured quads.

Additional detail to the server thread (working code)

An fbo is created during initialization:

void init(void) {
    glGenFramebuffer(1, &fbo);
}

The render loop of the server looks roughly like this:

GLuint loop(void) {
    glBindFrameBuffer(GL_FRAMEBUFFER, fbo);
    glViewport(0,0,width,height);

    GLuint tex;
    glGenTextures(1, &tex);
    glBindTexture(GL_TEXTURE_2D, tex);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);

    // Framebuffer completeness check omitted

    glClear(GL_COLOR_BUFFER_BIT);

    // actual drawing code omitted

    // the drawing code bound other textures, so..
    glBindTexture(GL_TEXTURE_2D, tex);
    glGenerateMipmap(GL_TEXTURE_2D);

    glBindTexture(GL_TEXTURE_2D, GL_NONE);
    glFlush();

    return tex;
}

All this works fine so far.

New (buggy) code

Now i want to add Multisampling to the server thread, using the GL_APPLE_framebuffer_multisample extension and modified the the initialization code like this:

void init(void) {
    glGenFramebuffer(1, &resolve_fbo);
    glGenFramebuffers(1, &sample_fbo);
    glBindFramebuffer(GL_FRAMEBUFFER, sample_fbo);
    glGenRenderbuffers(1, &sample_colorRenderbuffer);
    glBindRenderbuffer(GL_RENDERBUFFER, sample_colorRenderbuffer);
    glRenderbufferStorageMultisampleAPPLE(GL_RENDERBUFFER, 4, GL_RGBA8_OES, width, height);
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, sample_colorRenderbuffer);

    // Framebuffer completeness check (sample_fbo) omitted

    glBindRenderbuffer(GL_RENDERBUFFER, GL_NONE);
    glBindFramebuffer(GL_FRAMEBUFFER, GL_NONE);
}

The main loop has been changed to:

GLuint loop(void) {
    glBindFrameBuffer(GL_FRAMEBUFFER, sample_fbo);
    glViewport(0,0,width,height);

    GLuint tex;
    glGenTextures(1, &tex);
    glBindTexture(GL_TEXTURE_2D, tex);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);

    glClear(GL_COLOR_BUFFER_BIT);

    // actual drawing code omitted

    glBindFramebuffer(GL_FRAMEBUFFER, resolve_fbo);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);

    // Framebuffer completeness check (resolve_fbo) omitted

    // resolve multisampling
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER_APPLE, resolve_fbo);
    glBindFramebuffer(GL_READ_FRAMEBUFFER_APPLE, sample_fbo);
    glResolveMultisampleFramebufferAPPLE();

    // the drawing code bound other textures, so..
    glBindTexture(GL_TEXTURE_2D, tex);
    glGenerateMipmap(GL_TEXTURE_2D);

    glBindTexture(GL_TEXTURE_2D, GL_NONE);
    glFlush();

    return tex;
}

What i see now is that a texture contains data from multiple loop() calls, blended together. I guess I’m either missing an ‘unbind’ of some sort, or probably a glFinish() call (I previously had such a problem at a different point, I set texture data with glTexImage2D() and used it right afterwards – that required a glFinish() call to force the texture to be updated).

However inserting a glFinish() after the drawing code didn’t change anything here..

  • 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-06-05T05:42:17+00:00Added an answer on June 5, 2026 at 5:42 am

    Oh nevermind, such a stupid mistake. I omitted the detail that the loop() method actually contains a for loop and renders multiple textures, the mistake was that i bound the sample fbo only before this loop, so after the first run the resolve fbo was bound..

    Moving the fbo binding inside the loop fixed the problem.

    Anyway, thanks @ all the readers and sorry for wasting your time 🙂

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

Sidebar

Related Questions

I have the following architecture for a project I'm working on. My question is
I'm working on my HW for computer architecture and I came across the following
I am working on a Spring application (Spring 3.0) and following layered architecture i.e.
In the following (working) code example, the templated register_enum() function is used to iterate
I have the following working tar -pcvf base.tar input/myPacket/my2 --exclude-vcs input/myPacket/my3/*.bmp When i have
The following is working as expected. It shows the default CPM and CPC for
The following is working as expected. for schema in `mysql -eshow databases` do if
I'm working on the following LINQ query: public void GetAuditRuleAgencyRecords(IEnumerable<Entities.AuditRule> rules) { using (LinqModelDataContext
I am working on the following code: import java.io.*; import javax.xml.parsers.*; import javax.xml.transform.*; import
I am working with the following piece; def index @user = User.find(params[:id]) rescue flash[:notice]

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.