X-Git-Url: http://pileus.org/git/?p=grits;a=blobdiff_plain;f=src%2Fgrits-opengl.c;h=0b4100a8f48672401d471895b26df4649b40f848;hp=3d7b7dd12a718ddf6bac02c83509e2c5df706f8e;hb=74a55fb8afe07234c705513d324c6cc373e18f8a;hpb=64cd64653195ced67f25f6b8560953f420c0746c diff --git a/src/grits-opengl.c b/src/grits-opengl.c index 3d7b7dd..0b4100a 100644 --- a/src/grits-opengl.c +++ b/src/grits-opengl.c @@ -67,14 +67,14 @@ static void _set_visuals(GritsOpenGL *opengl) double width = GTK_WIDGET(opengl)->allocation.width; double height = GTK_WIDGET(opengl)->allocation.height; - double ang = atan(height/FOV_DIST); + double ang = atan((height/2)/FOV_DIST)*2; double atmos = 100000; double near = MAX(elev*0.75 - atmos, 50); // View 100km of atmosphere double far = elev + 2*EARTH_R + atmos; // on both sides of the earth grits_viewer_get_location(GRITS_VIEWER(opengl), &lat, &lon, &elev); glViewport(0, 0, width, height); - gluPerspective(rad2deg(ang)*2, width/height, near, far); + gluPerspective(rad2deg(ang), width/height, near, far); /* Setup camera and lighting */ glMatrixMode(GL_MODELVIEW); @@ -469,6 +469,8 @@ static void grits_opengl_unproject(GritsViewer *_opengl, gdouble *lat, gdouble *lon, gdouble *elev) { GritsOpenGL *opengl = GRITS_OPENGL(_opengl); + if (!opengl->sphere->view) + return; gdouble x, y, z; if (pz < 0) { gfloat tmp = 0;