PDA

View Full Version : GLwDrawingArea



Deiussum
02-18-2004, 05:37 AM
Has anyone here ever used the GLwDrawingArea widget for Xt? I'm still pretty new to Xt, but I know my way around a compiler pretty well, but haven't been able to get a linker error fixed yet.

Here's a bit of the code I'm using, which is based on a simple Xt tutorial I found that I am trying to add a GL widget to.




int main(int argc, char** argv)
{
Widget toplevel, form, w, gl;

toplevel = XtOpenApplication(&app_context, "XFirst", NULL, 0, &argc,
argv, NULL, applicationShellWidgetClass, NULL, 0);

form = XtVaCreateManagedWidget("form", formWidgetClass, toplevel, NULL);
//w = XtVaCreateManagedWidget("quit_button", commandWidgetClass, form,
// XtNlabel, "Quit", NULL);
w = XtVaCreateManagedWidget("quit_button", commandWidgetClass, form, NULL);

gl = XtVaCreateManagedWidget("gl_test", glwDrawingAreaWidgetClass,
form, GLwNrgba, True, NULL);
//gl = GLwCreateMDrawingArea(form, "gl_test", NULL, 0);


XtAddCallback(gl, GLwNexposeCallback, GLDisplay, NULL);
XtAddCallback(gl, GLwNresizeCallback, GLResize, NULL);
XtAddCallback(gl, GLwNginitCallback, GLInit, NULL);
XtAddCallback(w, XtNcallback, quit_proc, NULL);

XtRealizeWidget(toplevel);

XtAppMainLoop(app_context);


return 0;
}


The compile line looks like so:



gcc -I/usr/X11R6/include -L/usr/X11R6/lib -L/usr/X11R6/lib/modules/extensions -l
Xt -lXaw -lGL -lGLU -lGLw -lX11 -lm -lXext -lXm -o xtgltest xtgltest.c
/tmp/ccsd65f1.o(.text+0x86): In function `main':
: undefined reference to `glwDrawingAreaWidgetClass'
collect2: ld returned 1 exit status
make: *** [xtgltest] Error 1


And I did a grep to find which library glwDrawingAreaWidgetClass was found in like so:



grep glwDrawingAreaWidgetClass /usr/X11R6/lib/*
Binary file /usr/X11R6/lib/libGLw.a matches


I only have a .a library for libGLw, and no .so, could that have anything to do with it? Is there some additional command-line parameter I need to give to gcc for it to use .a libraries?

My system is running Slackware 9.1, gcc v3.2.3, and the nVidia Linux drivers with a GeForce 2 MX.

Deiussum
02-18-2004, 07:22 AM
Nevermind. I fixed it by changing the order of the parameters I passed to gcc, it now looks like so:



gcc -o xtgltest xtgltest.c -I/usr/X11R6/include -L/usr/X11R6/lib -lGL -lXt -lXm -lGLw -lXaw

I'm logging into my Linux box remotely to compile right now, so I can't test that I can actually get a window working with this widget yet, but it'll be the first thing I try when I get home tonight! http://www.opengl.org/discussion_boards/ubb/smile.gif

[This message has been edited by Deiussum (edited 02-18-2004).]