Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: Simple graphical project, satellite tracking / visualization

  1. #21
    Junior Member Regular Contributor
    Join Date
    Apr 2012
    Location
    Los Angeles
    Posts
    189
    Quote Originally Posted by thor36 View Post
    ... I would like to save some sweat, time, nerves and errors with drawing a sphere, since the central point of my project are orbits and physical calculations of spacecraft motion ...
    Google gluSphere. It generates all of the vertices and polygons making up a sphere. You have control over the number of lat-lon divisions it generates. Also, if you request, it generates texture coordinates allowing you to wrap a world map image around the sphere without any ugly seams. This is what I use in my sims.

    You are smart in the way you're setting your priorities. You are developing a very small application. No need to spend a lot of time worrying about ultra-efficient OpenGL. Doing the graphics simply will allow you to concentrate on the engineering features of your sim.

  2. #22
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,161
    Quote Originally Posted by thor36 View Post
    Do you mind if I ask for what purpose have you designed such an accurate model of Earth ?
    I'm a long time in 3D terrain rendering for GIS, and I wanted to develop algorithm to precisely render the whole planet using clipmaps (with cm precision or higher).
    Something like Google Earth, but better.

    Quote Originally Posted by thor36 View Post
    About the algorithm that you have just described me for creating a sphere - is it documented anywhere in terms of pseudo code or perhaps even better implemented in OpenGL already ? I can say honestly that I would like to save some sweat, time, nerves and errors with drawing a sphere, since the central point of my project are orbits and physical calculations of spacecraft motion - not to mention that I am beginner in OpenGL and that takes a lot of extra effort itself
    Being in education for a long time, I prefer not to give students a complete solution. Rather I give them a clue and force them to find solution by themselves.
    What I mention is a quite simple math. It needs 5 minutes to be accomplished. But, if you wish a "complete" solution this is the code:
    Code :
    for(double Theta = -90.0; Theta < 90.0; Theta+= dTheta)
    {
        glBegin(GL_TRIANGLE_STRIP);
        for(double Phi = -180.0; Phi <= 180.0; Phi+= dPhi)
        {
            double x = r*cos(Theta*toRad)*sin(Phi*toRad);
            double y = r*sin(Theta*toRad);
            double z = r*cos(Theta*toRad)*cos(Phi*toRad);
            glVertex3d(x,y,z);
            x = r*cos((Theta+dTheta)*toRad)*sin(Phi*toRad);
            y = r*sin((Theta+dTheta)*toRad);
            z = r*cos((Theta+dTheta)*toRad)*cos(Phi*toRad);
            glVertex3d(x,y,z);
        }
        glEnd();
    }
    This is totally unoptimized version, but is servers the purpose.The result is shown in the following picture. Click image for larger version. 

Name:	Sphere_resize.jpg 
Views:	34 
Size:	11.5 KB 
ID:	1272
    Next step is to define texture coordinates and normals. Then put it into a display list, vertex array or VBO.

  3. #23
    Junior Member Newbie
    Join Date
    Mar 2014
    Posts
    18
    Thank you both, Carmine and Alexandar. I think I am equipped with the basic information I need for now to try tackle the project. Any tips are always welcome of course
    Last edited by thor36; 04-23-2014 at 04:49 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •