From 6a532537b8bc6a802fd058486a02a0d72b6933f7 Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Wed, 10 Feb 2010 13:35:32 +0000 Subject: [PATCH] Fix marker locations --- src/gis-opengl.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gis-opengl.c b/src/gis-opengl.c index ba0f913..34e4c8d 100644 --- a/src/gis-opengl.c +++ b/src/gis-opengl.c @@ -233,6 +233,9 @@ static void _draw_marker(GisOpenGL *opengl, GisMarker *marker) gis_viewer_project(GIS_VIEWER(opengl), point->lat, point->lon, point->elev, &px, &py, &pz); + gint win_width = GTK_WIDGET(opengl)->allocation.width; + gint win_height = GTK_WIDGET(opengl)->allocation.height; + py = win_height - py; if (pz > 1) return; @@ -244,8 +247,7 @@ static void _draw_marker(GisOpenGL *opengl, GisMarker *marker) glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glOrtho(0, GTK_WIDGET(opengl)->allocation.width, - 0, GTK_WIDGET(opengl)->allocation.height, -1, 1); + glOrtho(0, win_width, win_height, 0, -1, 1); glTranslated(px - marker->xoff, py - marker->yoff, 0); @@ -254,11 +256,12 @@ static void _draw_marker(GisOpenGL *opengl, GisMarker *marker) glDisable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, marker->tex); + glDisable(GL_CULL_FACE); glBegin(GL_QUADS); - glTexCoord2f(1, 1); glVertex3f(width, 0 , 0); - glTexCoord2f(1, 0); glVertex3f(width, height, 0); - glTexCoord2f(0, 0); glVertex3f(0 , height, 0); - glTexCoord2f(0, 1); glVertex3f(0 , 0 , 0); + glTexCoord2f(1, 0); glVertex3f(width, 0 , 0); + glTexCoord2f(1, 1); glVertex3f(width, height, 0); + glTexCoord2f(0, 1); glVertex3f(0 , height, 0); + glTexCoord2f(0, 0); glVertex3f(0 , 0 , 0); glEnd(); } -- 2.43.2