Browse Source

nviz: Add width & height to render_window struct; Make sure to set the viewport on renderer initialization

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@72966 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho 6 years ago
parent
commit
0cacb23a30
2 changed files with 10 additions and 0 deletions
  1. 1 0
      include/nviz.h
  2. 9 0
      lib/nviz/render.c

+ 1 - 0
include/nviz.h

@@ -136,6 +136,7 @@ struct render_window
     HGLRC contextId;		/* rendering context */
     HGLRC contextId;		/* rendering context */
     HBITMAP bitmapId;
     HBITMAP bitmapId;
 #endif
 #endif
+    int width, height;
 };
 };
 
 
 #include <grass/defs/nviz.h>
 #include <grass/defs/nviz.h>

+ 9 - 0
lib/nviz/render.c

@@ -52,6 +52,9 @@ void Nviz_init_render_window(struct render_window *rwin)
     rwin->contextId = NULL;
     rwin->contextId = NULL;
     rwin->bitmapId = NULL;
     rwin->bitmapId = NULL;
 #endif
 #endif
+
+    rwin->width = 0;
+    rwin->height = 0;
 }
 }
 
 
 /*!
 /*!
@@ -174,6 +177,10 @@ int Nviz_create_render_window(struct render_window *rwin, void *display,
     rwin->contextId = wglCreateContext(rwin->displayId);
     rwin->contextId = wglCreateContext(rwin->displayId);
     /* TODO */
     /* TODO */
 #endif
 #endif
+
+    rwin->width = width;
+    rwin->height = height;
+
     return 0;
     return 0;
 }
 }
 
 
@@ -211,5 +218,7 @@ int Nviz_make_current_render_window(const struct render_window *rwin)
     wglMakeCurrent(rwin->displayId, rwin->contextId);
     wglMakeCurrent(rwin->displayId, rwin->contextId);
 #endif
 #endif
 
 
+    GS_set_viewport(0, rwin->width, 0, rwin->height);
+
     return 1;
     return 1;
 }
 }