support for changing viewport as per texture dimensions and restoring the old parameters when done