cl-gl interoperabilty with multi gpus/displays

when i am using clCreateGLTextureFrom2D, it is giving CL_INVALID_GLOBJECT error.

my code is working in single gpu mode, that is if i am not using XOpenDisplay,visualinfo functions then createcontext, it is working fine.

If i do export DISPLAY=:0.2 at terminal and then execution, it is working fine, that is it is displaying in 0.2 display.
Where as, if do it programatically using AMD PARALLEL PROGRAMMING OPEN CL GUIDE, multi gpu code in linux , it is giving the above error.

Please help me.
Thank you.