Просмотр исходного кода

nviz: Fix double buffering & swapping; Remove GS_set_swap_func (shouldn't be user-settable; ever need to replace the default swapping?)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@72970 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho 6 лет назад
Родитель
Сommit
5909bd454c
7 измененных файлов с 16 добавлено и 31 удалено
  1. 0 1
      include/defs/ogsf.h
  2. 2 2
      lib/nviz/render.c
  3. 0 1
      lib/ogsf/gs2.c
  4. 14 3
      lib/ogsf/gsd_prim.c
  5. 0 13
      lib/ogsf/gsx.c
  6. 0 2
      lib/ogsf/ogsflib.dox
  7. 0 9
      misc/m.nviz.image/main.c

+ 0 - 1
include/defs/ogsf.h

@@ -185,7 +185,6 @@ void GS_getlight_ambient(int, float *, float *, float *);
 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 *);

+ 2 - 2
lib/nviz/render.c

@@ -100,7 +100,7 @@ int Nviz_create_render_window(struct render_window *rwin, void *display,
 #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 @@ int Nviz_create_render_window(struct render_window *rwin, void *display,
 #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 */
 

+ 0 - 1
lib/ogsf/gs2.c

@@ -119,7 +119,6 @@ void GS_libinit(void)
 	    Region[0], Region[1], Region[2], Region[3], Gv.scale, first);
     
     Cxl_func = void_func;
-    Swap_func = void_func;
 
     
     if (first) {

+ 14 - 3
lib/ogsf/gsd_prim.c

@@ -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,8 +482,13 @@ void gsd_swapbuffers(void)
     /* OGLXXX swapbuffers: 
        glXSwapBuffers(*display, window);
        replace display and window */
-
-    Swap_func();
+#if defined(OPENGL_X11)
+    glXSwapBuffers(glXGetCurrentDisplay(), glXGetCurrentDrawable());
+#elif defined(OPENGL_AQUA)
+    aglSwapBuffers(aglGetCurrentContext());
+#elif defined(OPENGL_WINDOWS)
+    SwapBuffers(wglGetCurrentDC());
+#endif
 
     return;
 }

+ 0 - 13
lib/ogsf/gsx.c

@@ -19,7 +19,6 @@
 #include <grass/ogsf.h>
 
 void (*Cxl_func) ();
-void (*Swap_func) ();
 
 static int Cxl = 0;
 
@@ -56,15 +55,3 @@ void GS_set_cxl_func(void (*f) (void))
 
     return;
 }
-
-/*!
-   \brief Set swap function
-
-   \param pointer to function
- */
-void GS_set_swap_func(void (*f) (void))
-{
-    Swap_func = f;
-
-    return;
-}

+ 0 - 2
lib/ogsf/ogsflib.dox

@@ -311,8 +311,6 @@ viewer positioning, and lighting.
 
 - GS_set_SDsurf()
 
-- GS_set_swap_func()
-
 - GS_set_trans()
 
 - GS_set_twist()

+ 0 - 9
misc/m.nviz.image/main.c

@@ -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 @@ int main(int argc, char *argv[])
     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 @@ int main(int argc, char *argv[])
 
     exit(EXIT_SUCCESS);
 }
-
-void swap_gl()
-{
-    return;
-}