[GRASS-SVN] r72970 - in grass/trunk: include/defs lib/nviz lib/ogsf misc/m.nviz.image

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jul 10 09:39:55 PDT 2018


Author: hcho
Date: 2018-07-10 09:39:54 -0700 (Tue, 10 Jul 2018)
New Revision: 72970

Modified:
   grass/trunk/include/defs/ogsf.h
   grass/trunk/lib/nviz/render.c
   grass/trunk/lib/ogsf/gs2.c
   grass/trunk/lib/ogsf/gsd_prim.c
   grass/trunk/lib/ogsf/gsx.c
   grass/trunk/lib/ogsf/ogsflib.dox
   grass/trunk/misc/m.nviz.image/main.c
Log:
nviz: Fix double buffering & swapping; Remove GS_set_swap_func (shouldn't be user-settable; ever need to replace the default swapping?)

Modified: grass/trunk/include/defs/ogsf.h
===================================================================
--- grass/trunk/include/defs/ogsf.h	2018-07-10 08:44:19 UTC (rev 72969)
+++ grass/trunk/include/defs/ogsf.h	2018-07-10 16:39:54 UTC (rev 72970)
@@ -185,7 +185,6 @@
 int GS_check_cancel(void);
 void GS_set_cancel(int);
 void GS_set_cxl_func(void (*)(void));
-void GS_set_swap_func(void (*)(void));
 
 /* GS_util.c */
 double GS_geodistance(double *, double *, const char *);

Modified: grass/trunk/lib/nviz/render.c
===================================================================
--- grass/trunk/lib/nviz/render.c	2018-07-10 08:44:19 UTC (rev 72969)
+++ grass/trunk/lib/nviz/render.c	2018-07-10 16:39:54 UTC (rev 72970)
@@ -100,7 +100,7 @@
 #if defined(OPENGL_X11)
     int attributeList[] = { GLX_RGBA, GLX_RED_SIZE, 1,
 	GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1,
-	GLX_DEPTH_SIZE, 1, None
+	GLX_DEPTH_SIZE, 1, GLX_DOUBLEBUFFER, None
     };
     XVisualInfo *v;
 
@@ -135,7 +135,7 @@
 #elif defined(OPENGL_AQUA)
     int attributeList[] = { AGL_RGBA, AGL_RED_SIZE, 1,
 	AGL_GREEN_SIZE, 1, AGL_BLUE_SIZE, 1,
-	AGL_DEPTH_SIZE, 1, AGL_NONE
+	AGL_DEPTH_SIZE, 1, AGL_DOUBLEBUFFER, AGL_NONE
     };
     /* TODO: open mac display */
 

Modified: grass/trunk/lib/ogsf/gs2.c
===================================================================
--- grass/trunk/lib/ogsf/gs2.c	2018-07-10 08:44:19 UTC (rev 72969)
+++ grass/trunk/lib/ogsf/gs2.c	2018-07-10 16:39:54 UTC (rev 72970)
@@ -119,7 +119,6 @@
 	    Region[0], Region[1], Region[2], Region[3], Gv.scale, first);
     
     Cxl_func = void_func;
-    Swap_func = void_func;
 
     
     if (first) {

Modified: grass/trunk/lib/ogsf/gsd_prim.c
===================================================================
--- grass/trunk/lib/ogsf/gsd_prim.c	2018-07-10 08:44:19 UTC (rev 72969)
+++ grass/trunk/lib/ogsf/gsd_prim.c	2018-07-10 16:39:54 UTC (rev 72970)
@@ -21,12 +21,18 @@
 
 #include <grass/config.h>
 
-#if defined(OPENGL_X11) || defined(OPENGL_WINDOWS)
+#if defined(OPENGL_X11)
 #include <GL/gl.h>
 #include <GL/glu.h>
+#include <GL/glx.h>
 #elif defined(OPENGL_AQUA)
 #include <OpenGL/gl.h>
 #include <OpenGL/glu.h>
+#include <AGL/agl.h>
+#elif defined(OPENGL_WINDOWS)
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include <wingdi.h>
 #endif
 
 #include <grass/gis.h>
@@ -476,9 +482,14 @@
     /* OGLXXX swapbuffers: 
        glXSwapBuffers(*display, window);
        replace display and window */
+#if defined(OPENGL_X11)
+    glXSwapBuffers(glXGetCurrentDisplay(), glXGetCurrentDrawable());
+#elif defined(OPENGL_AQUA)
+    aglSwapBuffers(aglGetCurrentContext());
+#elif defined(OPENGL_WINDOWS)
+    SwapBuffers(wglGetCurrentDC());
+#endif
 
-    Swap_func();
-
     return;
 }
 

Modified: grass/trunk/lib/ogsf/gsx.c
===================================================================
--- grass/trunk/lib/ogsf/gsx.c	2018-07-10 08:44:19 UTC (rev 72969)
+++ grass/trunk/lib/ogsf/gsx.c	2018-07-10 16:39:54 UTC (rev 72970)
@@ -19,7 +19,6 @@
 #include <grass/ogsf.h>
 
 void (*Cxl_func) ();
-void (*Swap_func) ();
 
 static int Cxl = 0;
 
@@ -56,15 +55,3 @@
 
     return;
 }
-
-/*!
-   \brief Set swap function
-
-   \param pointer to function
- */
-void GS_set_swap_func(void (*f) (void))
-{
-    Swap_func = f;
-
-    return;
-}

Modified: grass/trunk/lib/ogsf/ogsflib.dox
===================================================================
--- grass/trunk/lib/ogsf/ogsflib.dox	2018-07-10 08:44:19 UTC (rev 72969)
+++ grass/trunk/lib/ogsf/ogsflib.dox	2018-07-10 16:39:54 UTC (rev 72970)
@@ -311,8 +311,6 @@
 
 - GS_set_SDsurf()
 
-- GS_set_swap_func()
-
 - GS_set_trans()
 
 - GS_set_twist()

Modified: grass/trunk/misc/m.nviz.image/main.c
===================================================================
--- grass/trunk/misc/m.nviz.image/main.c	2018-07-10 08:44:19 UTC (rev 72969)
+++ grass/trunk/misc/m.nviz.image/main.c	2018-07-10 16:39:54 UTC (rev 72970)
@@ -26,8 +26,6 @@
 
 #include "local_proto.h"
 
-static void swap_gl();
-
 int main(int argc, char *argv[])
 {
     struct GModule *module;
@@ -74,8 +72,6 @@
     GS_libinit();
     GVL_libinit();
 
-    GS_set_swap_func(swap_gl);
-
     /* define render window */
     offscreen = Nviz_new_render_window();
     Nviz_init_render_window(offscreen);
@@ -251,8 +247,3 @@
 
     exit(EXIT_SUCCESS);
 }
-
-void swap_gl()
-{
-    return;
-}



More information about the grass-commit mailing list