sub tick { my ($self,$texture_id) = @_; # save current frame from input fbo glBindTexture(GL_TEXTURE_2D, $texture_id); my $frame; for my $i (reverse (0..$self->height-1)) { glReadPixels_s(0,$i,$self->width,1,GL_RGB,GL_UNSIGNED_BYTE,my $line); $frame .= $line; }; syswrite $self->stream, $frame, $self->width * $self->height * $self->depth or die "Write failure"; };