G'Day ! Well Electric-Fence did not help, but playing around with gdb did allow me to narrow down the focus. It appears to be dying in the glarea_reshape function. Does anything look strange to anyone ? I set a break point on this function. It stops at the line: int w = widget->allocation.width; when I type continue it immediately SEGSEGV at the address listed below. I suspect the the line: if (gtk_gl_area_make_current (GTK_GL_AREA(widget))) { is the problem, but it is required by Gtkglarea, and it is the exactly the same line as in the example program that works. So I am pretty baffled right now. Any suggestions would be appreciated. (even a response saying "bummer dude", would at least let me know you are alive :-) cheers BTW any one know who currently maintains gtk_gl_area ? /*****************************************************************************/ * * Function: glarea_reshape (GtkWidget*, GdkEventConfigure*) * * This function performs the operations needed to maintain the viewing area * of the GtkGLArea. This should be called whenever the size of the area * is changed. * *****************************************************************************/ /* * --- This is called ChangeSize( ) in the "OpenGL Super Bible" * ... It's a GLUT thing :-) */ gint glarea_reshape (GtkWidget *widget, GdkEventConfigure *event) { int w = widget->allocation.width; int h = widget->allocation.height; g_print ("Reshape Event (ie ChangeSize)\n"); /* gtk_gl_area_make_current MUST be called before rendering */ /* into the GtkGLArea. */ if (gtk_gl_area_make_current (GTK_GL_AREA(widget))) { /* This is an example 2D reshape function. Writing reshape */ /* functions is beyond the scope of this demo. Check the */ /* red book or the www.opengl.org for more information on */ /* how to write reshape code to suit your needs. */ /********** glViewport (0, 0, w, h); glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluOrtho2D (-(w>>1), (w>>1), -(h>>1), h>>1); glMatrixMode (GL_MODELVIEW); **********/ /* --- The following code is from "OpenGL Super Bible" for 3D --- */ GLfloat nRange = 100.0f; // Prevent a divide by zero if(h == 0) h = 1; // Set Viewport to window dimensions glViewport(0, 0, w, h); // Reset coordinate system glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Establish clipping volume (left, right, bottom, top, near, far) if (w <= h) { glOrtho (-nRange, nRange, -nRange*h/w, nRange*h/w, -nRange, nRange); } else { glOrtho (-nRange*w/h, nRange*w/h, -nRange, nRange, -nRange, nRange); } glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } return (TRUE); } /*****************************************************************************************************************/ cheers, Jim Parker Sailboat racing is not a matter of life and death .... It is far more important than that !!! ----- Forwarded by Jim Parker/Coinstar Inc/US on 10/19/00 01:30 PM ----- Jim Parker To: jlof mail student oulu fi, chris65536 home com 10/18/00 cc: gtk-app-devel-list gnome org 01:36 PM Subject: GtkGLArea demo programs G'Day ! I am trying to add a GtkGLArea to my program as a substitute for a gdk_drawing_area. However when I complie the demo programs that are part of the GtkGLArea tarball, I keep getting Segmentation Faults on all the demo programs except the "Zktor" BTW ... I'm using GKT+/GLIB 1.2.8 MESA 3.2.1 GtkGLArea 1.2.2 In GtkGLArea_demo.c .... I have compiled them with debug symbols, but when I run it under gdb, all I get is the following memory address. 0x4041a59d in ( ) which does not do me any good :-( I tried modifying the code to give me a better indication of where the problem is, but no progress yet. Tonight I'll try using electric-fence and/or other memory debuggers Any ideas what might be the problem ? This is my modifed version. The original can be found in the GtkGLArea tarball. (See attached file: OpenGLtest.c) cheers, Jim Parker Sailboat racing is not a matter of life and death .... It is far more important than that !!!
Attachment:
OpenGLtest.c
Description: Binary data