Example #1
0
void WorldWizApp::draw() {
            
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClearAccum(0.0, 0.0, 0.0, 0.0);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective (23.0, screenAspect, 0.5, 50);
    
    
    //Vec3f cpos = Vec3f(cos(orbitDegrees)*12.0f ,0.0f,sin(orbitDegrees)*12.0f);
    //gluLookAt(cpos.x,cpos.y,cpos.z, 0,0,0, 0,1,0);        
   // cpos.x = 0;
   // cpos.y = 0;
   // cpos.z = 0;
    
    gluLookAt(0,0,0, -1,0,0, 0,1,0);    
    
   // world.globeShader.uniform("CAMERA_POSITION",cpos);
    
    glMatrixMode(GL_MODELVIEW);
    
    glPushMatrix();
    glLoadIdentity();
    
    glPushMatrix();

    glLoadIdentity();
    GLfloat light_position[] = { -10.0, 4.0, 0.0, 1.0 };
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);
    GLfloat lm_ambient[] = { 0.5, 0.5, 0.5, 1.0 };    
    glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lm_ambient);    
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);

    glPopMatrix();
    
    glTranslatef( -15., 0, 0 );
    orbitDegrees += 0.3f;
    glRotatef(orbitDegrees, 0.f, 1.f, 0.5f);
    

    
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_LINE_SMOOTH);
    glEnable(GL_POINT_SMOOTH);
    //glEnable(GL_POLYGON_SMOOTH);
    
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_BLEND);
    glEnable(GL_MULTISAMPLE);
    
    glShadeModel(GL_FLAT);//glShadeModel(GL_SMOOTH);
    
    glLineWidth(1.5);
    
    world.render();        
    
    testTrajectory.render(&world);
    
    glPopMatrix();
    
    

    
}