I found a solution here CUDA 11.6 OpenGL interoperability broken?
I just set the env variable before running the sample and the it works. I think its fine setting it permanent
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia ./camera_replay
OR (set permanent)
echo "export __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia"
>> ~/.bashrc
then
/.camera_replay
works directly