I'm a complete novice when it comes to this, so this attempt may be
terribly misguided and naive.

I was aiming pretty low, trying to get a window up on the screen, but
I couldn't get one. The closest I came was with this code:

loadlib P1, "libglut.so"
print "Loaded\n"
dlfunc P0, P1, "glutInitDisplayMode", "vi"
set I5,2
invoke
dlfunc P0, P1, "glutCreateWindow", "vt"
set S5,"Example"
invoke
dlfunc P0, P1, "glutMainLoop", "v"
invoke
end

which errors with "#GLUT: Fatal Error in (unamed): redisplay needed for
window 1, but no display callback." because I can't give it a callback
function. But I saw a window flash up for a split second. So I wrote
a shared-library wrapper,

#include <GL/glut.h>
void
glut_display_callback ()
{
}
void
myhello ()
{

glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB |
GLUT_DEPTH );
glutCreateWindow("blender");
glutDisplayFunc(glut_display_callback);
glutMainLoop();
}


which fails with:

relocation error: ./libmyhello.so: undefined symbol:
glutInitDisplayMode

I had been hoping that the glut libraries I relied
on would be loaded as well. Nothing I did (including loadlib "libglut"
in parrot) would get my wrapper to see the glut library.

I then tried similar things with glX, the X-windows specific version of
GL, but it kept crashing for reasons I couldn't figure out. I thought glX would be worth trying for because it doesn't require callbacks to paint on the screen (I think).


So I'll just settle down and wait for a callback mechanism, unless
there's a simple way of working around the problems.

On a more design note, what are the benefits of gl parrot opcodes vs. a loaded library?

Reply via email to