ios - OpenGL ES 3.0 - Jagged Edges When Rendering Into Retained Color Attachment -


using openggl es 3.0 on ios, want use 1 framebuffer object (fbo) 2 color attachments (a0, a1) render object(s) a0 a0 , a1 a1. texture a1 retained , reused in next frame(s) while a0 invalidated (and cleared).

the problem when rendering a1 jagged artefacts (mostly along object edges) created, c.f. attached image (color attachment 1 = a0, color attachment 2 = a1).

gpu snapshot in xcode - artefacts in color attachment 1

i inspected gl state , made sure correct fbo bound , there no gl_errors , gl_max_color_attachments 4. create fbo 2 color attachments follows:

// assuming fbo , 2 requried textures correctly generated  glbindframebuffer(gl_framebuffer, _fbo); glframebuffertexture2d(gl_draw_framebuffer, gl_color_attachment0, gl_texture_2d, _fbo_tex[0], 0); glframebuffertexture2d(gl_draw_framebuffer, gl_color_attachment1, gl_texture_2d, _fbo_tex[1], 0);  // glcheckframebufferstatus(gl_framebuffer) returns gl_framebuffer_complete 

the vertex shader:

#version 300 es uniform mat4 modelviewprojectionmatrix; in vec4 position;  void main() {     gl_position = modelviewprojectionmatrix * position; } 

the fragment shader render a0:

#version 300 es uniform lowp vec4 colorin; layout(location = 0) out lowp vec4 colorout;  void main() {     colorout = colorin; } 

the fragment shader render a1:

#version 300 es uniform lowp vec4 colorin; layout(location = 1) out lowp vec4 colorout;  void main() {     colorout = colorin; } 

and here's render code:

// assuming correct vertex array bound glbindframebuffer(gl_draw_framebuffer, _fbo); {     gluseprogram(_program_for_a0);     const glenum attachments[] = {gl_color_attachment0};     gldrawbuffers(1, attachments);     glclear(gl_color_buffer_bit);      // draw a0 gl_color_attachment0 } {     gluseprogram(_program_for_a1);     const glenum attachments[] = {gl_none, gl_color_attachment1};     gldrawbuffers(2, attachments);     // no glclear() call      // draw a1 gl_color_attachment1 } 

and here invalidation:

const glenum attachments[] = {gl_color_attachment0}; glinvalidateframebuffer(gl_draw_framebuffer, 1, attachments); 

in case helpful information, artefacts seem caused due tiling mechanism 32x32 pixel blocks. highly appreciated.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -