From: Patrick S. <mai...@st...> - 2005-01-17 00:28:15
|
Hi to all, My application runs fine. I think I have found the problem but it could probably be something more. Here are some hints relating to the (old) GlCanvas.hs sample from the source. 1. I use glCanvasSetCurrent as first command in the opengl display function and before doing any gl commands. This seems to be nesassary and is done in every wxGTK sample. 2. You have to do a glCanvasSwapBuffers at the end of the display function. Because I thing thinks like doublebuffering are done by the gui and every animated thing use doublebuffers. 3. The third hint is probably the most important. The on paintRaw is a bit different from the on paint event (yes, it have to.. :-). I think the one big difference is that it doesn't clean the dc before drawing on it if I understand the documentation in the right way. And thats the big mistake. When you just use the on paint recall nothing appears except of when you resize or move your frame. Then in a part of a millisecond your opengl screen appears. So here is the hint: Do what you want in the frame or other panels, but the glcanvas have to had the on paintRaw recall and everything is fine. 4. This isn't related direct to the "nothing appears" problem but I spent a full night to find the mistake and think its helpfull to know. When you want some initializations do it after all frames and panels are created and the event functions are set. I tried to switch light and depthbuffer on and did it directly after creating the glCanvas. It drove me mad because I searched the whole lighting stuff and didn't find the mistake.. I hope I figured this stuff in the right way out. It works for me. Cheers Patrick On Wednesday 12 January 2005 14:36, shelarcy wrote: > Hmm, Keeping my eyes on this discussion, I have to chage my sample code. > So I chage the sample following Patrick Scheibe sample. > Here is a newer version. > > On Tue, 11 Jan 2005 12:15:38 +0100, Daan Leijen <da...@cs...> wrote: > >> A friend of mine helped me solving the problem. > >> It was really confusing. I just added any printouts in the display > >> function of opengl and found out that wxhaskell called this display > >> func. But why should it be called and even though nothing appeared in > >> the frame. > > > > Ah, this is really good to hear, > > I have been playing with the sample but couldn't find > > a solution myself. > > > > Good luck with your further experiments, |