954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

OpenGL in MDI application

Hi all,

I want to have a MDI application with OpenGL enabled on child forms. additionally each form can have controls than OpenGL. I have tried Nehe's lessons but all of them have used an infinite loop to call glDraw function which can not be done in MDI application as there may be multiple forms opened simultaneously. I need a replacement of OnDraw function of CView class in VC++. I have tried to overried OnPaint event of Form but it is not usefull as image disappears if you resize window etc.

kashifbhatti
Newbie Poster
6 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

You can do it as an infinite loop you would just need to call a function to do te drawing on each of the relevant forms in the loop.

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

I have already tried and found of no use, as i mentioned my original post that when form is resized or restored from minimized state then all drawings disappear and i have to wait for a couple of seconds. But when i coded same thing using CView in VC++ it was perfect.

kashifbhatti
Newbie Poster
6 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

That doesnt sound normal. As long as your form calls invalidate it should paint, and as part of your paint it should draw the openGL part.. I dont see ayn reason that wouldnt work.

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

I have called Form.Invalidate/Refresh from each event of the Form to repaint the form, but it is not doing so well. I think reason may be the number of triangles i am drawing (whcih is more than 300 thousands).

kashifbhatti
Newbie Poster
6 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

That is quite a lot, especially then if you multiply it up over multiple forms. What sort of FPS are you getting?

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You