Date: Tue, 9 Jan 2001 18:53:00 +0100 To: Chris Hecker Cc: lablgtk at kaba.or.jp Subject: Re: resize event? Message-ID: <20010109185300.A888 at lambda.u-strasbg.fr> References: <4.3.2.7.2.20010105002151.00baf5c0 at shell16.ba.best.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4.3.2.7.2.20010105002151.00baf5c0 at shell16.ba.best.com>; from checker at d6.com on Fri, Jan 05, 2001 at 12:23:18AM -0800 From: Sven LUTHER Sender: Sven LUTHER On Fri, Jan 05, 2001 at 12:23:18AM -0800, Chris Hecker wrote: > > [Resent to the list to keep people updated...Jacques and I had a private thread going.] > > >It is possible that events work differently on windows and X11. > >Try using other events, like configure, in place of expose, this may > >work better. > > I tried configure, but that didn't work either. Which one is supposed to be called on resize? > > Now that I've looked at it closer, it looks like the image does get repainted on resize, it's just that the window gets cleared immediately afterwards. I may be a bit ate on this one, but in my experience, and from the gtk+ tutorial on gtk_drawing_area and such : * the configure event is the one called when the object gets resized, created and such. * the expose event is the one called when part of the window is again redrawn. i nthe mlgtk tutorial 3 example, i use a drawingarea widget whit an offscreen pixmap in which i do normal drawing, and which i draw to the drawingarea after a bunch of drawing. I have to redraw the part of the pixmap that was obscured at the expose event and have to create a new offscreen pixmap of the new size at each expose event, thus loosing all drawings i have done in the previous one. Hope this helps. Now, i have also a question : i am using a GlArea widget to do OpenGL drawing into, i create it with : let area = GlGtk.area [`DOUBLEBUFFER;`RGBA;`DEPTH_SIZE 1] ~width:600 ~height:400 () and do some matrix stuff in it like it is done in the GL examples : ignore (area#event#connect#after#configure ~callback: begin function _ -> GlMat.mode `projection; GlMat.load_identity (); GlMat.ortho ~x:(-1.0,1.0) ~y:(-1.0,1.0) ~z:(-1.0,1.0); false end); now, if i understood it well, (fst ~x, fst ~y) is the coordinate of the lower left corner of the glArea and (snd ~x, snd ~y) is the coordinate of the upper right corner of the GLArrea. The problem with this is that : - the glarea being 600x400, this gives me an non-orthogonal view, which don't have correct 90° angles. - when i use the button_press callback, i get coordinates in the -1,1 range. - when i resize window, i get a larger window, but the button_press event still seem to be providing me the older values, not sure though. if i provide the area with a 400x400 size, everything works well. if i do : GlMat.ortho ~x:(-1.5,1.5) ~y:(-1.0,1.0) ~z:(-1.0,1.0); i think i will preserver the correct ratio, but nothing happens. if i do GlMat.ortho ~x:(-300.0,300.0) ~y:(-200.0,200.0) ~z:(-1.0,1.0); i think i will get coordinates in the -300/300,-200/200 range, but it is not the case ... mmm, ... openGL is doing some strange tricks to me here, any help would be welcome ... Friendly, Sven Luther