# To subscribers of the xforms list from spl@ncmir.ucsd.edu :
> I've tried using fl_winresize instead of fl_set_form_size - same
> effect. Note that I said that a reduction of size from 3x to 2x
> draws half the picture (top half in bottom half of window) - this is
> why I think it is a geometry problem.
Are you setting glViewport() to the size of the Canvas? How about
glOrtho() or gluPerspective()? Are you getting what you expect from
the Canvas struct's `w' and `h' members?
Here's how I set up the Canvas's handlers:
fl_add_canvas_handler( form->display_canvas, Expose,
expose_event_handler, NULL );
fl_add_canvas_handler( form->display_canvas, ConfigureNotify,
configure_notify_event_handler, NULL );
fl_add_canvas_handler( form->display_canvas, KeyPress,
key_press_event_handler, NULL );
fl_add_canvas_handler( form->display_canvas, ButtonPress,
button_event_handler, NULL );
fl_add_canvas_handler( form->display_canvas, ButtonRelease,
button_event_handler, NULL );
Here's more or less what I do at the beginning of each redraw:
fl_activate_glcanvas( canvas );
glDrawBuffer( GL_BACK );
glViewport( 0, 0, canvas->w, canvas->h );
glClearColor( 0.0, 0.0, 0.5, 0.0 );
glClear( GL_COLOR_BUFFER_BIT );
glClear( GL_DEPTH_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( ( GLfloat ) perspective,
( GLfloat ) canvas->w / ( GLfloat ) canvas->h,
0.1 * diagonal, diagonal * 2.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
[...]
This works for either user resize or programmatic resize.
If you could provide a minimal example which exhibits the symptoms,
it would be helpful in providing further insight.
spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://world.std.com/~xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/
This archive was generated by hypermail 2b29 : Wed May 01 2002 - 13:54:15 EDT