[GRASS-dev] GRASS 6.4 release branch on OS X

Glynn Clements glynn at gclements.plus.com
Tue Dec 23 01:40:06 EST 2008


William Kyngesburye wrote:

> I just committed a patch so render.c compiles on OSX.  nviz_cmd should  
> compile, but it won't work.  At least it smooths the build process.

A couple of things to try:

Index: lib/nviz/render.c
===================================================================
--- lib/nviz/render.c	(revision 35000)
+++ lib/nviz/render.c	(working copy)
@@ -205,6 +205,7 @@
 	return 1;
 
     aglSetCurrentContext(rwin->contextId);
+    aglSetPBuffer(rwin->contextId, rwin->windowId, 0, 0, 0);
 #elif defined(OPENGL_WINDOWS)
     if (!rwin->displayId || !rwin->contextId)
 	return 0;
Index: include/nviz.h
===================================================================
--- include/nviz.h	(revision 35000)
+++ include/nviz.h	(working copy)
@@ -131,7 +131,6 @@
     AGLPixelFormat pixelFmtId;
     AGLContext contextId;
     AGLPbuffer windowId;
-    GWorldPtr pixmap;
 #elif defined(OPENGL_WINDOWS)
     HDC displayId;		/* display context */
     HGLRC contextId;		/* rendering context */

I don't think that the pixmap field is meaningful if we're using a
pBuffer.

The aglSetPBuffer() is from:

http://developer.apple.com/DOCUMENTATION/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_offscreen/chapter_5_section_4.html

The first two zeros should be correct, the third is a guess.

It may also turn out to be necessary to provide more attributes to
aglChoosePixelFormat(). AFAICT, leaving too many settings at "default"
might result in choosing a render which doesn't support pBuffers.

http://developer.apple.com/DOCUMENTATION/GraphicsImaging/Reference/AGL_OpenGL/Reference/reference.html#//apple_ref/doc/uid/TP30000414-F15007

It might be worth using GL_RGB rather than GL_RGBA in
aglCreatePBuffer(). I don't think that we need the alpha channel, and
this may improve robustness (in X, asking for an alpha channel is
adding one more possible reason for failure).

I don't know whether you need to use aglUpdateContext() for a pBuffer.

http://developer.apple.com/DOCUMENTATION/GraphicsImaging/Reference/AGL_OpenGL/Reference/reference.html#//apple_ref/doc/uid/TP30000414-F15019

Also, OSX supports the use of arbitrary blocks of memory for
(software-only) off-screen rendering (similar to OSMesa). That might
be worth investigating as a fall-back in case pBuffers don't work.

http://developer.apple.com/DOCUMENTATION/GraphicsImaging/Reference/AGL_OpenGL/Reference/reference.html#//apple_ref/doc/uid/TP30000414-F15023

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list