# Mapping 3D Earth texture on gluSphere to form ECEF frame

Greetings all.
I am a beginner with OpenGL, so I will very much appreciate some help

I am using this project as a basis for the work I am trying to do. I suppose pasting all that code in the thread is not the best idea, but if needed I can do it.

I have a set of coordinates of satellites (in kilometers) that I will draw around the gluSphere (Earth). I have problems with rendering when I want to make the radius of the sphere equal to that of Earth in kilometers (6371 km), which I need to do if I want to use the satellite coordinates that I have. I donâ€™t see the â€śEarthâ€ť being drawn on the scene even when I try various translations with â€śglTranslatef(0.0f, 0.0f, -X)â€ť.
What do I need to change in code in order to be able to use â€śrealâ€ť kilometeres for distance units in the simulation and see the Earth rendered properly ?

Thank you very much and kind regards,
T

My first guess is that your far plane is too close. That example uses

``````
gluPerspective(45.0, (float)w / (float)h, 1.0, 200.0);

``````

So if your units are km, anything more than 200 km from the viewpoint will be clipped.

As well as increasing the far distance, youâ€™ll also need to increase the near distance if you donâ€™t want the depth resolution to be very coarse for almost the entire scene. Make the near distance as high as you can get away with. If you need to support extreme variations in distance (e.g. having a satellite ten metres in front of the viewpoint, with the earth in the background), youâ€™ll need to use multiple passes.

I have a set of coordinates of satellites (in kilometers) that I will draw around the gluSphere (Earth). I have problems with rendering when I want to make the radius of the sphere equal to that of Earth in kilometers (6371 km), which I need to do if I want to use the satellite coordinates that I have.
I do a lot of orbital graphics. I strongly suggest you start with a sphere of radius = 1.0 (they use 2.0 in the example). Then scale the satellite cords down by r = 1/6371. An easy way to do this would be to call glScalef (r, r, r) just after the earth sphere is drawn. Put your Draw_Satellites routine after the glScalef call.

This way you donâ€™t have to fuss with the clipping planes. Also, it will be very easy to change the program to adapt to any system of units (nm, ft, etc). All youâ€™d have to do is change the value of r.

Good luck.