Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes! I found what I was doing wrong. I wrongly thought that I could have the following:</p> <p>Framebuffer</p> <ul> <li><p>Multisampled colour render buffer attached to a texture</p></li> <li><p>Multisampled depth buffer</p></li> </ul> <p>But you cannot do this. D: You have to have the following:</p> <p>Multisampled framebuffer:</p> <ul> <li><p>Multisampled colour render buffer (Not attached to a texture)</p></li> <li><p>Multisampled depth render buffer</p></li> </ul> <p>Normal framebuffer:</p> <ul> <li><p>Colour render buffer attached to a texture. This is what will be written to by glResolveMultisampleFramebufferAPPLE() and what we will use to render the result.</p></li> <li><p>No depth buffer.</p></li> </ul> <p>I.e. you have to copy the results of the multisampled render to a whole new framebuffer.</p> <p>Some code:</p> <pre class="lang-cpp prettyprint-override"><code> glGenTextures(1, &amp;texture); glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA4, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glGenFramebuffers(1, &amp;resolved_framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, resolved_framebuffer); glGenRenderbuffers(1, &amp;resolvedColorRenderbuffer); glBindRenderbuffer(GL_RENDERBUFFER, resolvedColorRenderbuffer); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); glGenFramebuffers(1, &amp;framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); glGenRenderbuffers(1, &amp;colorRenderbuffer); glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer); glRenderbufferStorageMultisampleAPPLE(GL_RENDERBUFFER, 4, GL_RGBA8_OES, width, height); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer); glGenRenderbuffers(1, &amp;depthRenderbuffer); glBindRenderbuffer(GL_RENDERBUFFER, depthRenderbuffer); glRenderbufferStorageMultisampleAPPLE(GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT16, width, height); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthRenderbuffer); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER) ; if(status != GL_FRAMEBUFFER_COMPLETE) { NSLog(@"failed to make complete framebuffer object %x", status); } // Render my scene glBindFramebuffer( GL_FRAMEBUFFER, framebuffer ); glViewport(0,0,width,height); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Draw scene // Then bind default framebuffer glBindFramebuffer( GL_FRAMEBUFFER, 1 ); // Draw other things // Now resolve the multisampling into the other fbo glBindFramebuffer( GL_READ_FRAMEBUFFER_APPLE, framebuffer ); glBindFramebuffer( GL_DRAW_FRAMEBUFFER_APPLE, resolved_framebuffer ); glResolveMultisampleFramebufferAPPLE(); glBindTexture( GL_TEXTURE_2D, texture ); // Draw with texture </code></pre> <p>Thanks Goz, you got me in the right direction!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload