XForms: Initialisation of OpenGL

Eef Hartman (E.J.M.Hartman@math.tudelft.nl)
Fri, 17 Apr 1998 13:16:27 +0200 (METDST)

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

Either I'm very stupid or I'm just overlooking something:

Configuration: Linux PC (2.0.30 kernel), Xforms 0.88.1 (so shared library)
and MesaGL 2.5 (also).
The application is just a form with as its ONLY object a glcanvas.
For the canvas an "expose" and a "buttonpress" handler have been defined.

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;
static float matrix[16] = { 2.0, 0.0, 0.0, 0.0,
0.0, 2.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0,
-1.0,-1.0, 0.0, 1.0 };

glViewport(0,0, (GLint)w, (GLint)h);
glClearColor(0.0,0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(matrix);

glBegin(GL_LINE_STRIP);
fout = glGetError();

All gl calls up to the "Begin" are ok, return 0 in GetError.
The Begin (this example is simplified, normally there would be all kinds
of loops to test IF there is any data to display, but no other gl or fl
calls) always returns INVALID_OPERATION.

Background: the "buttonpress" routine will process mouse-clicks within
the canvas, the data (points, defining line strips will be stored within
a double chain. 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 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, defined
BY that chain of structures, using "Vertex2f" calls, but I never get
that far, as the Begin is already refused.

I must be forgetting something, but I just don't see it.

-- 
    \     /   /
   /#. # #-  #  /
  ## ## ## ##  ##
 # #   ## ##  ##
" "  #    ## ##
"."  ".   "./
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
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/