Changeset 32043
- Timestamp:
- Jul 8, 2008, 2:32:12 AM (16 years ago)
- Location:
- grass/trunk
- Files:
-
- 2 edited
-
include/nviz.h (modified) (3 diffs)
-
lib/nviz/render.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
grass/trunk/include/nviz.h
r32033 r32043 1 1 #ifndef GRASS_NVIZ_H 2 2 #define GRASS_NVIZ_H 3 4 #include <grass/gsurf.h>5 #include <grass/gstypes.h>6 3 7 4 /*** Windows headers ***/ … … 34 31 # error Unsupported platform, or confused platform defines... 35 32 #endif 33 34 #include <grass/gsurf.h> 35 #include <grass/gstypes.h> 36 36 37 37 #define MAP_OBJ_UNDEFINED 0 … … 110 110 111 111 struct render_window { 112 #if defined(OPENGL_X11) 112 113 Display *displayId; /* display connection */ 113 114 GLXContext contextId; /* GLX rendering context */ 115 GLXPixmap windowId; 114 116 Pixmap pixmap; 115 GLXPixmap windowId; 117 #elif defined(OPENGL_AQUA) 118 AGLPixelFmtID displayId; 119 AGLContext contextId; 120 AGLPixmap windowId; 121 GWorldPtr pixmap; 122 #elif defined(OPENGL_WGL) 123 /* TODO */ 124 #endif 116 125 }; 117 126 -
grass/trunk/lib/nviz/render.c
r31945 r32043 10 10 for details. 11 11 12 Based on visualization/nviz/src/togl.c etc.12 Based on visualization/nviz/src/togl.c 13 13 14 14 \author Updated/modified by Martin Landa <landa.martin gmail.com> (Google SoC 2008) … … 58 58 void Nviz_destroy_render_window(struct render_window *rwin) 59 59 { 60 #if defined(OPENGL_X11) 60 61 glXDestroyContext(rwin->displayId, rwin->contextId); 62 glXDestroyGLXPixmap(rwin->displayId, rwin->windowId); 61 63 XFreePixmap(rwin->displayId, rwin->pixmap); 64 #elif defined(OPENGL_AQUA) 65 aglDestroyContext(rwin->contextId); 66 aglDestroyAGLPixmap(rwin->windowId); 67 /* TODO FreePixMap */ 68 #elif defined(OPENGL_WGL) 69 /* TODO: wglDeleteContext( HRC hrc ) */ 70 #endif 62 71 63 72 G_free ((void *) rwin); … … 79 88 int width, int height) 80 89 { 90 #if defined(OPENGL_X11) 81 91 XVisualInfo *v; 92 #elif defined(OPENGL_AQUA) 93 AGLPixelFmtID v; 94 #elif defined(OPENGL_WGL) 95 int v; 96 #endif 82 97 83 98 int attributeList[] = { GLX_RGBA, GLX_RED_SIZE, 1, … … 86 101 87 102 /* get the default display connection */ 103 #if defined(OPENGL_X11) 88 104 rwin->displayId = XOpenDisplay((char *) display); 105 #elif defined(OPENGL_AQUA) 106 /* TODO */ 107 #elif defined(OPENGL_WGL) 108 /* TODO */ 109 #endif 110 89 111 if (!rwin->displayId) { 90 G_fatal_error (_("Bad Xserver connection"));112 G_fatal_error (_("Bad server connection")); 91 113 } 92 114 93 115 /* get visual info and set up pixmap buffer */ 116 #if defined(OPENGL_X11) 94 117 v = glXChooseVisual(rwin->displayId, 95 118 DefaultScreen(rwin->displayId), … … 97 120 98 121 rwin->contextId = glXCreateContext(rwin->displayId, 99 v, NULL, GL_FALSE); 122 v, NULL, GL_FALSE); 123 #elif defined(OPENGL_AQUA) 124 /* TODO */ 125 rwin->displayId = aglChoosePixelFmt(GDHandle *dev, int ndev, attributeList); 126 127 rwin->contextId = aglCreateContext(rwin->display, NULL); 128 #elif defined(OPENGL_WGL) 129 /* TODO int ChoosePixelFormat( HDC hdc, PIXELFORMATDESCRIPTOR *pfd ) */ 130 #endif 131 100 132 if (!rwin->contextId) { 101 G_fatal_error (_("Unable to create GLXrendering context"));133 G_fatal_error (_("Unable to create rendering context")); 102 134 } 103 135 136 137 #if defined(OPENGL_X11) 104 138 /* create win pixmap to render to (same depth as RootWindow) */ 105 139 rwin->pixmap = XCreatePixmap(rwin->displayId, … … 112 146 rwin->windowId = glXCreateGLXPixmap(rwin->displayId, 113 147 v, rwin->pixmap); 148 #elif defined(OPENGL_AQUA) 149 /* create win pixmap to render to (same depth as RootWindow) */ 150 rwin->pixmap = NULL; /* TODO */ 151 /* create an off-screen AGL rendering area */ 152 rwin->windowId = aglCreateAGLPixmap(rwin->displayId, 153 rwin->pixmap); 154 #elif defined(OPENGL_WGL) 155 /* TODO */ 156 #endif 114 157 115 158 if (v) { … … 133 176 return 0; 134 177 178 #if defined(OPENGL_X11) 135 179 if (rwin->contextId == glXGetCurrentContext()) 136 180 return 1; … … 138 182 glXMakeCurrent(rwin->displayId, rwin->windowId, 139 183 rwin->contextId); 184 #elif defined(OPENGL_AQUA) 185 if (rwin->contextId == aglGetCurrentContext()) 186 return 1; 140 187 141 /* TODO: AQUA */ 188 aglMakeCurrent(rwin->windowId, rwin->contextId); 189 #elif defined(OPENGL_WGL) 190 /* TODO wglMakeCurrent( HDC hdc, HGLRC hrc ) */ 191 #endif 142 192 143 193 return 1;
Note:
See TracChangeset
for help on using the changeset viewer.
