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

I checked out the release branch today.

It compiled fine, except for nviz_cmd (./lib/nviz/render.c needs to be deleted in order for this to compile).

I tried some basic display functions and it seems to be fine.

Michael

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.

On Dec 22, 2008, at 6:58 PM, Michael Barton wrote:

I checked out the release branch today.

It compiled fine, except for nviz_cmd (./lib/nviz/render.c needs to be deleted in order for this to compile).

I tried some basic display functions and it seems to be fine.

Michael

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"This is a question about the past, is it? ... How can I tell that the past isn't a fiction designed to account for the discrepancy between my immediate physical sensations and my state of mind?"

- The Ruler of the Universe

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@gclements.plus.com>