opengl - glReadPixels always returns a black image -


some times ago wrote code draw opengl scene bitmap in delphi rad studio xe7, worked well. code draw , finalize scene, pixels using glreadpixels function. tried compile same code on lazarus, black image.

here code

// create main render buffer glgenframebuffers(1, @m_overlayframebuffer); glbindframebuffer(gl_framebuffer, m_overlayframebuffer);  // create , link color buffer render glgenrenderbuffers(1, @m_overlayrenderbuffer); glbindrenderbuffer(gl_renderbuffer, m_overlayrenderbuffer); glrenderbufferstorage(gl_renderbuffer, gl_rgba8, width, height); glframebufferrenderbuffer(gl_framebuffer,                           gl_color_attachment0,                           gl_renderbuffer,                           m_overlayrenderbuffer);  // create , link depth buffer use glgenrenderbuffers(1, @m_overlaydepthbuffer); glbindrenderbuffer(gl_renderbuffer, m_overlaydepthbuffer); glrenderbufferstorage(gl_renderbuffer, gl_depth_component, width, height); glframebufferrenderbuffer(gl_framebuffer,                           gl_depth_attachment,                           gl_renderbuffer,                           m_overlaydepthbuffer);  // check if render buffers created correctly , return result result := (glcheckframebufferstatus(gl_framebuffer) = gl_framebuffer_complete);  ...  // flush opengl glfinish; glpixelstorei(gl_pack_alignment,   4); glpixelstorei(gl_pack_row_length,  0); glpixelstorei(gl_pack_skip_rows,   0); glpixelstorei(gl_pack_skip_pixels, 0);  // create pixels buffer setlength(pixels, (m_powner.clientwidth * m_factor) * (m_powner.clientheight * m_factor) * 4);  // alpha blending or antialiasing enabled? if (m_transparent or (m_factor <> 1))     // notify pixels read color buffer     glreadbuffer(gl_color_attachment0);  // copy scene opengl pixels buffer glreadpixels(0,              0,              m_powner.clientwidth  * m_factor,              m_powner.clientheight * m_factor,              gl_rgba,              gl_unsigned_byte,              pixels); 

as verified , i'm 100% sure drawn on scene (also on lazarus side), glext initialized , framebuffer correctly built (the condition glcheckframebufferstatus(gl_framebuffer) = gl_framebuffer_complete returns true), grateful if point me i'm doing wrong in code, knowing 1 more time on same computer works in delphi rad studio xe7 not in lazarus.

regards


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -