[GRASS-dev] [grass-code P][372] scritps for converting raster maps into GRASS 7 format, and back

Glynn Clements glynn at gclements.plus.com
Sat Apr 21 15:17:58 EDT 2007

Michael Barton wrote:

> > You shouldn't need pyOpenGL unless you're planning on making OpenGL
> > calls from Python. The only parts of NVIZ which make OpenGL calls are
> > Togl and do_zoom.c. NVIZ is just a UI; all of the actual work is done
> > by the OGSF library.
> So we don't need pyOpenGL to replace Togl?


> Does the wxPython GLCanvas replace Togl?


> Somehow we need to make calls from wxPython event handlers to
> actually display/render a 3D image. I'm totally in the dark as to how this
> is done. I've worked with the UI part of NVIZ (this is the overwhelmingly
> greatest part, as you point out), but don't understand how the OGL calls are
> actually made.

OpenGL is called by OGSF (GS_*, gsd_* etc), which is called by the
various N_*_cmd() functions in the C part of NVIZ. These functions are
registered as Tcl commands, and the Tcl commands are called from the
various Tcl scripts.

In general, any Tcl command which begins with "N" (but not "Nv_"),
e.g. Ndraw_all, is implemented in C. Typically a Tcl command "Nfoo"
corresponds to the C function Nfoo_cmd(), although there are some
exceptions, e.g. Ndraw_all corresponds to Ndraw_all_together_cmd(). 

Some of the functions are little more than wrappers around individual
OGSF functions, which others (e.g. Ndraw_all) are more complex.

Most of the bindings are in src/init_commands.c; grep for
"Tcl_CreateCommand" in src/*.c for a complete list.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list