@tonyo_au,
thanks for the reply. What I'm trying to do is I have a robot ( sphere or disk ) in 2D controlled by mouse movement. Now, this disk has ability to render beams ( lines ) as a half circle scan with a given angle (1 degree ). There is a static obstacle in this virtual environment. Once the obstacle inside the scan area, it gives me the distance as a real format laser sensor data. I'm totally sure this is possible, however I've not found any tutorial or book about this issue so far.

What issue? You've mostly given a description of your setting, but not a very clear problem statement. Which of the things you describe are given, which do you want to calculate?
If you have the sensor data you describe you can use OpenGL to make a visualization of it. If on the other hand you want to simulate the sensor itself you basically need to compute intersections of rays with a 3D environment. OpenGL does not help with that. You may want to look at ray tracing systems, in particular ones that are not specifically built for image generation - for example Nvidia's OptiX can be used for this purpose.