[GRASS-dev] nviz python thoughts
William Kyngesburye
woklist at kyngchaos.com
Sun Dec 21 13:51:00 EST 2008
On Dec 21, 2008, at 12:14 PM, Glynn Clements wrote:
>> ... Some sample code from Apple - it's about using surface textures,
>> but the window parts could be useful:
>
> Using OpenGL in a window should be taken care of by wxGLCanvas. It's
> getting off-screen contexts which we (probably) have to do ourselves.
>
> The situation is the same with the existing nviz; Togl provides a
> canvas on which OpenGL can be used. The only glX/wgl/agl functions
> outside of Togl are the code in do_zoom.c to get an off-screen context
> for saving output to files.
>
I guess I'm missing something here. I understand about the offscreen
part, so where does the window come in in render.c? Is it a hidden
window, just so we can get the context?
>> Looks like mac_win is just a placeholder here. For now, comment this
>> line and have Nviz_make_current_render_window return 0 for
>> OPENGL_AQUA?
>
> In that case, just:
>
> /* TODO: mac_win */
> - aglMakeCurrent((AGLDrawable) mac_win, rwin->contextId);
> + aglMakeCurrent((AGLDrawable) 0, rwin->contextId);
>
> should get it to compile (which is all we're after for now).
Should it return 0, just to be nice? presumably, nviz_cmd would fail
gracefully if the render.c functions return a failure, but would it do
so on success but with a nonexistent context?
Anyways, the online API docs that we found way back when to get the
function names seems to have been wrong. Strangely, render.c compiles
with the wrong names, but doesn't link:
Undefined symbols:
"_aglChoosePixelFmt", referenced from:
_Nviz_create_render_window in render.o
"_aglCreateAGLPixmap", referenced from:
_Nviz_create_render_window in render.o
"_aglMakeCurrent", referenced from:
_Nviz_make_current_render_window in render.o
"_aglDestroyAGLPixmap", referenced from:
_Nviz_destroy_render_window in render.o
Indeed, these are not in the AGL headers. What I can find is:
extern AGLPixelFormat aglChoosePixelFormat(const AGLDevice *gdevs,
GLint ndev, const GLint *attribs);
extern GLboolean aglSetCurrentContext(AGLContext ctx);
(I didn't see any form of "make current", with a context AND display/
window parameters)
There don't appear to be any pixmap functions, but there are pbuffer
functions.
Looks like nviz.h has the right names for types in the render_window
struct.
PS. render.h is not included by render.c, or anything else in GRASS.
It looks like everything in render.h is in nviz.h. Maybe render.h
should be deleted? (it was confusing me with it's duplicated
render_window declaration)
-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/
"We are at war with them. Neither in hatred nor revenge and with no
particular pleasure I shall kill every ___ I can until the war is
over. That is my duty."
"Don't you even hate 'em?"
"What good would it do if I did? If all the many millions of people of
the allied nations devoted an entire year exclusively to hating the
____ it wouldn't kill one ___ nor shorten the war one day."
<Ha, ha> "And it might give 'em all stomach ulcers."
- Tarzan, on war
More information about the grass-dev
mailing list