[GRASS-dev] Re: nvizlib compile error

Are we at a place yet where I can compile and test this on a Mac, given it's location of OpenGL in the agl directory?

Michael

On Jul 9, 2008, at 12:36 AM, <grass-dev-request@lists.osgeo.org> <grass-dev-request@lists.osgeo.org > wrote:

Date: Tue, 08 Jul 2008 18:48:05 +0200
From: Moritz Lennert <mlennert@club.worldonline.be>
Subject: [GRASS-dev] nvizlib compile error
To: grass-dev <grass-dev@lists.osgeo.org>
Message-ID: <48739A45.3050606@club.worldonline.be>
Content-Type: text/plain; charset=windows-1252; format=flowed

I get an error trying to compile lib/nviz on a Debian system with a
fresh SVN checkout of trunk:

"~/SRC/GRASS/grass_trunk/lib/nviz$ make
gcc
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include
-Wall -g -O2 -fPIC -DPACKAGE=\""grasslibs"\" -I/usr/include
-DPACKAGE=\""grasslibs"\"
-I/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include -o
OBJ.i486-pc-linux-gnu/cplanes_obj.o -c cplanes_obj.c
In file included from cplanes_obj.c:19:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/nviz.h:31:4:
error: #error Unsupported platform, or confused platform defines...
In file included from cplanes_obj.c:19:
/home/mlennert/SRC/GRASS/grass_trunk/dist.i486-pc-linux-gnu/include/grass/nviz.h:113:
error: expected specifier-qualifier-list before ‘Display’
make: *** [OBJ.i486-pc-linux-gnu/cplanes_obj.o] Erreur 1"

- configure output shows:

checking for location of OpenGL library...
checking for glBegin in -lGL... yes
checking for gluBeginCurve in -lGLU... yes
checking for glXCreatePbuffer... yes
checking for glXCreateGLXPixmap... yes
[...]
OpenGL support: yes

Moritz

I think there may still be some GLx vs AGL vs WGL differences to take care of? At least, I'm now getting this:

In file included from change_view.c:20:
/Users/Shared/src/GRASS/svn/trunk/dist.i386-apple-darwin9.3.0/include/grass/nviz.h:120: error: syntax error before ‘AGLPixelFmtID’
/Users/Shared/src/GRASS/svn/trunk/dist.i386-apple-darwin9.3.0/include/grass/nviz.h:120: warning: no semicolon at end of struct or union
/Users/Shared/src/GRASS/svn/trunk/dist.i386-apple-darwin9.3.0/include/grass/nviz.h:122: error: syntax error before ‘windowId’
/Users/Shared/src/GRASS/svn/trunk/dist.i386-apple-darwin9.3.0/include/grass/nviz.h:122: warning: data definition has no type or storage class
/Users/Shared/src/GRASS/svn/trunk/dist.i386-apple-darwin9.3.0/include/grass/nviz.h:127: error: syntax error before ‘}’ token
make: *** [OBJ.i386-apple-darwin9.3.0/change_view.o] Error 1

Checking with -E, I see that I'm getting the "struct render_window" as expected, so I don't know what's wrong. Maybe that should be a typedef? since render_window is used in render.c as:

struct render_window* Nviz_new_render_window();

On Jul 9, 2008, at 6:08 PM, Michael Barton wrote:

Are we at a place yet where I can compile and test this on a Mac, given it's location of OpenGL in the agl directory?

Michael

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

"I ache, therefore I am. Or in my case - I am, therefore I ache."

- Marvin

Michael Barton wrote:

Are we at a place yet where I can compile and test this on a Mac,
given it's location of OpenGL in the agl directory?

The code won't compile on a Mac at present.

AFAICT, it requires at least:

    /* TODO */
- rwin->displayId = aglChoosePixelFmt(GDHandle *dev, int ndev, attributeList);
+ rwin->displayId = aglChoosePixelFmt(NULL, 0, attributeList);

- rwin->contextId = aglCreateContext(rwin->display, NULL);
+ rwin->contextId = aglCreateContext(rwin->displayId, NULL);

    /* create win pixmap to render to (same depth as RootWindow) */
- rwin->pixmap = NULL; /* TODO */
+ rwin->pixmap = <no idea what should go here, but it ain't NULL>;

There is some information on AGL at:

[1] http://www.mesa3d.org/brianp/sig97/agl.txt
[2] http://www.mesa3d.org/brianp/sig97/compare.htm

but I don't know how much of that refers to "classic" rather than OSX.
There's a lot more information in visualization/nviz/src/togl.c, but
it doesn't include creating off-screen pixmaps.

I also note:

[3] http://www.iua.upf.es/~ggeiger/redbookhtml/apc.html

  Off-screen Rendering

  To render off-screen, first create an off-screen graphics
  world in the usual way, and pass the handle into
  aglCreateAGLPixmap().

Good luck on figuring out what "the usual way" is :wink:

A Google search for aglCreateAGLPixmap produces exactly 7 hits; I've
just posted three of them, and the other 4 seem to be duplicates of
[1] and [3].

IOW, everything that mentions aglCreateAGLPixmap seems to assume that
you are already familiar with normal (non-OpenGL) Mac GUI programming.

In any case, it's going to require some amount of trial and error from
someone with a Mac.

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

Thanks much William. Sounds like it's getting closer to working on a Mac.

Michael
____________________
C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

On Jul 9, 2008, at 8:09 PM, William Kyngesburye wrote:

I think there may still be some GLx vs AGL vs WGL differences to take care of? At least, I'm now getting this:

In file included from change_view.c:20:
/Users/Shared/src/GRASS/svn/trunk/dist.i386-apple-darwin9.3.0/include/grass/nviz.h:120: error: syntax error before ‘AGLPixelFmtID’
/Users/Shared/src/GRASS/svn/trunk/dist.i386-apple-darwin9.3.0/include/grass/nviz.h:120: warning: no semicolon at end of struct or union
/Users/Shared/src/GRASS/svn/trunk/dist.i386-apple-darwin9.3.0/include/grass/nviz.h:122: error: syntax error before ‘windowId’
/Users/Shared/src/GRASS/svn/trunk/dist.i386-apple-darwin9.3.0/include/grass/nviz.h:122: warning: data definition has no type or storage class
/Users/Shared/src/GRASS/svn/trunk/dist.i386-apple-darwin9.3.0/include/grass/nviz.h:127: error: syntax error before ‘}’ token
make: *** [OBJ.i386-apple-darwin9.3.0/change_view.o] Error 1

Checking with -E, I see that I'm getting the "struct render_window" as expected, so I don't know what's wrong. Maybe that should be a typedef? since render_window is used in render.c as:

struct render_window* Nviz_new_render_window();

On Jul 9, 2008, at 6:08 PM, Michael Barton wrote:

Are we at a place yet where I can compile and test this on a Mac, given it's location of OpenGL in the agl directory?

Michael

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

"I ache, therefore I am. Or in my case - I am, therefore I ache."

- Marvin

Hi,

thanks for the hits. I have commited some changes [1].

However I have no access to Mac. Needs some investigation how to make
off-screen rendering working.

Martin

[1] http://trac.osgeo.org/grass/changeset/32068

2008/7/10 Glynn Clements <glynn@gclements.plus.com>:

Michael Barton wrote:

Are we at a place yet where I can compile and test this on a Mac,
given it's location of OpenGL in the agl directory?

The code won't compile on a Mac at present.

AFAICT, it requires at least:

   /* TODO */
- rwin->displayId = aglChoosePixelFmt(GDHandle *dev, int ndev, attributeList);
+ rwin->displayId = aglChoosePixelFmt(NULL, 0, attributeList);

- rwin->contextId = aglCreateContext(rwin->display, NULL);
+ rwin->contextId = aglCreateContext(rwin->displayId, NULL);

   /* create win pixmap to render to (same depth as RootWindow) */
- rwin->pixmap = NULL; /* TODO */
+ rwin->pixmap = <no idea what should go here, but it ain't NULL>;

There is some information on AGL at:

[1] http://www.mesa3d.org/brianp/sig97/agl.txt
[2] http://www.mesa3d.org/brianp/sig97/compare.htm

but I don't know how much of that refers to "classic" rather than OSX.
There's a lot more information in visualization/nviz/src/togl.c, but
it doesn't include creating off-screen pixmaps.

I also note:

[3] http://www.iua.upf.es/~ggeiger/redbookhtml/apc.html

       Off-screen Rendering

       To render off-screen, first create an off-screen graphics
       world in the usual way, and pass the handle into
       aglCreateAGLPixmap().

Good luck on figuring out what "the usual way" is :wink:

A Google search for aglCreateAGLPixmap produces exactly 7 hits; I've
just posted three of them, and the other 4 seem to be duplicates of
[1] and [3].

IOW, everything that mentions aglCreateAGLPixmap seems to assume that
you are already familiar with normal (non-OpenGL) Mac GUI programming.

In any case, it's going to require some amount of trial and error from
someone with a Mac.

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

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

Martin,

I'm more than happy to test and report, but I have to at least get it compiled. It seems like it's getting closer.

Michael
____________________
C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

On Jul 9, 2008, at 11:24 PM, Martin Landa wrote:

Hi,

thanks for the hits. I have commited some changes [1].

However I have no access to Mac. Needs some investigation how to make
off-screen rendering working.

Martin

[1] Changeset 32068 – GRASS GIS

2008/7/10 Glynn Clements <glynn@gclements.plus.com>:

Michael Barton wrote:

Are we at a place yet where I can compile and test this on a Mac,
given it's location of OpenGL in the agl directory?

The code won't compile on a Mac at present.

AFAICT, it requires at least:

  /* TODO */
- rwin->displayId = aglChoosePixelFmt(GDHandle *dev, int ndev, attributeList);
+ rwin->displayId = aglChoosePixelFmt(NULL, 0, attributeList);

- rwin->contextId = aglCreateContext(rwin->display, NULL);
+ rwin->contextId = aglCreateContext(rwin->displayId, NULL);

  /* create win pixmap to render to (same depth as RootWindow) */
- rwin->pixmap = NULL; /* TODO */
+ rwin->pixmap = <no idea what should go here, but it ain't NULL>;

There is some information on AGL at:

[1] http://www.mesa3d.org/brianp/sig97/agl.txt
[2] http://www.mesa3d.org/brianp/sig97/compare.htm

but I don't know how much of that refers to "classic" rather than OSX.
There's a lot more information in visualization/nviz/src/togl.c, but
it doesn't include creating off-screen pixmaps.

I also note:

[3] http://www.iua.upf.es/~ggeiger/redbookhtml/apc.html

      Off-screen Rendering

      To render off-screen, first create an off-screen graphics
      world in the usual way, and pass the handle into
      aglCreateAGLPixmap().

Good luck on figuring out what "the usual way" is :wink:

A Google search for aglCreateAGLPixmap produces exactly 7 hits; I've
just posted three of them, and the other 4 seem to be duplicates of
[1] and [3].

IOW, everything that mentions aglCreateAGLPixmap seems to assume that
you are already familiar with normal (non-OpenGL) Mac GUI programming.

In any case, it's going to require some amount of trial and error from
someone with a Mac.

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

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

Hi,

2008/7/10 Michael Barton <michael.barton@asu.edu>:

I'm more than happy to test and report, but I have to at least get it
compiled. It seems like it's getting closer.

well, render.c is used only by nviz CLI module. To test wxGUI nviz
extension you can compile the library without render.c

cd lib/nviz/
rm render.c
make clean
make

cd gui/wxpython/nviz
make clean
make

g.gui &

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *

I'll give it a try.

Michael
____________________
C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

Phone: 480-965-6262
Fax: 480-965-7671
www: <www.public.asu.edu/~cmbarton>

On Jul 9, 2008, at 11:41 PM, Martin Landa wrote:

Hi,

2008/7/10 Michael Barton <michael.barton@asu.edu>:

I'm more than happy to test and report, but I have to at least get it
compiled. It seems like it's getting closer.

well, render.c is used only by nviz CLI module. To test wxGUI nviz
extension you can compile the library without render.c

cd lib/nviz/
rm render.c
make clean
make

cd gui/wxpython/nviz
make clean
make

g.gui &

Martin

-- Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *