 # How to draw a 3D globe?

I´m trying do draw a 3D globe, but don´t succeed.
A circle is beeing drawn, but then I would like to draw circels each with 1 grade angle increase since the last drawn circle. What do I have to modify in my code?

``````

{
gl.glBegin(GL.GL_LINE_LOOP);

for (int i=0; i < 360; i++)
{
for(int y=0; y<360; y++)
{
}
}

gl.glEnd();
}
``````

I suggest you try something simpler than a 3D globe first. Then move on to the globe. I say this because in the code above you say you are trying to do a 3D globe, but there are no Z coordinates computed or specified. You need x, y, and z coordinates to draw things in 3D. My suggestion is to first try to do a 3D cube with all x, y, and z coordinates set to +1 or -1. If you can do that it means you have a basic understanding of 3D coordinate systems, and OpenGL viewing transformations, i.e. orthographic, perspective, etc. Once you get a wireframe unit cube done, then try to do a wireframe, unit sphere, inside it.

1. Either use in built functions such as gluSphere()

2. or using your approach , need to draw circles with 3D coord with same diameter axis.

To easy things, draw two circles in 3D perpendicular to each other with same axis. Then change angle for the third circle so that it shares same axis but at an inclination != 90.

Try:

``````
Thanks for your answers! I will make a try within the next 24 hours and return here if I can’t get it working. awhig: I will check out gluSphere(). 