fn realize(self) -> Vec<u8> {
        // Allocate space for the image
        let size_bytes  = self.width * self.height * 4;
        let mut pixels  = vec![0; size_bytes];

        // Read the image from the main texture into the pixel array
        let texture     = self.main_render_target.texture().expect("Offscreen texture");
        unsafe {
            gl::BindTexture(gl::TEXTURE_2D, *texture);
            gl::GetTexImage(gl::TEXTURE_2D, 0, gl::RGBA, gl::UNSIGNED_BYTE, pixels.as_mut_ptr() as *mut c_void);

            panic_on_gl_error("Read offscreen texture");
        }

        pixels
    }
///
/// Consumes this render target and returns the realized pixels as a byte array
///
Consumes this render target and returns the realized pixels as a byte array
Consumes this render target and returns the realized pixels as a byte array
fn realize(self) -> Vec<u8> {
        // Allocate space for the image
        let size_bytes  = self.width * self.height * 4;
        let mut pixels  = vec![0; size_bytes];
        // Read the image from the main texture into the pixel array
        let texture     = self.main_render_target.texture().expect("Offscreen texture");
        unsafe {
            gl::BindTexture(gl::TEXTURE_2D, *texture);
            gl::GetTexImage(gl::TEXTURE_2D, 0, gl::RGBA, gl::UNSIGNED_BYTE, pixels.as_mut_ptr() as *mut c_void);
            panic_on_gl_error("Read offscreen texture");
        }
        pixels
    }
fn realize ( self ) -> Vec < u8 > { // Allocate space for the image let size_bytes = self . width * self . height * 4 ; let mut pixels = vec ! [ 0 size_bytes ] ; // Read the image from the main texture into the pixel array let texture = self . main_render_target . texture ( ) . expect ( " " ) ; unsafe { gl :: BindTexture ( gl :: TEXTURE_2D , * texture ) ; gl :: GetTexImage ( gl :: TEXTURE_2D , 0 , gl :: RGBA , gl :: UNSIGNED_BYTE , pixels . as_mut_ptr ( ) as * mut c_void ) ; panic_on_gl_error ( " " ) ; } pixels }
Consumes this render target and returns the realized pixels as a byte array
Consumes this render target and returns the realized pixels as a byte array
self