XForms: Problems with Mesa in a glcanvas object (2nd posting)

Eef Hartman (E.J.M.Hartman@math.tudelft.nl)
Tue, 26 May 1998 14:21:01 +0200 (METDST)

# To subscribers of the xforms list from Eef Hartman <E.J.M.Hartman@math.tudelft.nl> :

I still haven't solved my OpenGL problem, so once more I'm asking
all of you for help:

The configuration:
Linux PC (2.0.30 kernel),
Xforms 0.88.1 (so shared library, ELF non-glibc)
and Mesa 2.6 (same).

The application is just a simple form with as its ONLY object a glcanvas.
For the canvas an "expose" and a "buttonpress" handler have been defined.
The idea is that the expose handler should be drawing simple lines
(LINE_STRIPS) which can be put in or changed with the mouse.
The Xforms part of the program, including the mouse handling, works fine,
it is just the drawing of the lines through

This is the start of the "expose" handler:

FD_gltest *form;

int canvas_expose(FL_OBJECT *ob, Window win, int w, int h,
XEvent *xev, void *ud)
GLenum fout; /* temporary, for error codes */

fl_activate_glcanvas(ob); /* just to be sure */

glViewport(0,0, (GLint)w, (GLint)h);

/* this part is as simple as I can make it, no transformations, pure
"identity" matrices. All of the "glXxx" calls return 0, so should
be OK.
Then there original was an "if" to see IF there's anything to draw
but I'll leave that away for now (it has to test and get the data
from the malloc'ed chain's of memory blocks) */

/* now we start drawing */
fout = glGetError();

The "glBegin" _always_ returns INVALID_OPERATION.
So I never get to the real drawing part (which is actually rather simple).

I played around with it for a long time, even added the glPushMatrix,
but it all just doesn't seem to make any difference.

Does anyone have any idea what I'm missing?

Background: the coordinates (x,y only, the problem is pure 2-D at the
moment) run from (0,0) (bottom-left) to (1,1) (top-right) as normal floats
(so both x and y will go from 0.0 to 1.0, z is always 0 and w never used).
The expose event has to draw (or redraw) all of the line strips, which are
currently defined. But I never even get that far.

spl@szechuan.ucsd.edu (Steve Lamont) suggested:
> Try adding a call to fl_activate_glcanvas() before any call to
> OpenGL/MesaGL routines. Even if you have only one OpenGL drawing
> area, it might be that your GLXContext is getting invalidated for some
> reason.

Now, as you can see, I tried that but it makes no difference at all.

Also I elimated all coordinate transformations, use pure Identity matrices

    \     /   /
   /#. # #-  #  /
  ## ## ## ##  ##
 # #   ## ##  ##
" "  #    ## ##
"."  ".   "./
TTTTTTTTTT  UU      UU    Eef Hartman, System Administrator
    TT      UU      UU
    TT      UU      UU    Delft University of Technology
    TT      UU      UU    Mathematics (Applied Analysis) dept.
    TT      UU      UU    Mekelweg 4, P.O. Box 5031
    TT      UU      UU    2600 GA  Delft, The Netherlands
    TT       UU    UU     e-mail : E.J.M.Hartman@math.tudelft.nl
    TT        UUUUUU      fax    : +31-15-278 7209
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil   or see
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/