Click here to Skip to main content
16,013,516 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How does a modal dialog work (message pump)? Pin
Joaquín M López Muñoz29-May-02 8:29
Joaquín M López Muñoz29-May-02 8:29 
GeneralRe: How does a modal dialog work (message pump)? Pin
29-May-02 13:13
suss29-May-02 13:13 
GeneralRe: How does a modal dialog work (message pump)? Pin
29-May-02 18:20
suss29-May-02 18:20 
GeneralRe: How does a modal dialog work? Code snippets Pin
29-May-02 13:36
suss29-May-02 13:36 
GeneralRe: How does a modal dialog work? Code snippets Pin
Joaquín M López Muñoz29-May-02 23:12
Joaquín M López Muñoz29-May-02 23:12 
GeneralRe: How does a modal dialog work? Workaround Pin
30-May-02 0:50
suss30-May-02 0:50 
GeneralRe: How does a modal dialog work? Workaround Pin
Joaquín M López Muñoz30-May-02 2:36
Joaquín M López Muñoz30-May-02 2:36 
GeneralRe: How does a modal dialog work? Workaround Pin
30-May-02 6:59
suss30-May-02 6:59 
Joaquín M López Muñoz wrote:
First of all, have you finally solved the message pump mess following my proposal?

Yes, your ideas was helpfull! Smile | :) I think it didn't solve the problem yet how to keep the rendering of the OpenGL scene alive? I was thinking about suggestion 1. + 2. too; what do you think about my solution 3. with the repeated WM_PAINT (see my last post)?

Briefly explanation: The trick was letting Windows sending you WM_PAINTs as often as possible, so you do not need an additional timer, multimedia or high resultion timer triggering the rendering. When rendering the OpenGL scene (just imagine a game with at least 30 FPS) you mainly don't need very regular redraws (which usually is an illusion in a multitasking environment). But you want them as often/fast as possible!
The trick with the WM_PAINT is working because you do not validate the update region with DefWindowProc function, Windows will send another WM_PAINT soon. As far as I understood from one Codeproject tutorial, WM_PAINT is a virtual message that is generated on the fly, whenever nothing else is happening. Idea sounds good and testing software showed it works.
I still prefer to use my own message pump and direct triggering of the rendering in a game, but the WM_PAINT trick seems to be a nice way to mix a MFC application with OpenGL.

Well, I need to do some profiling (evaluating FPS). Basically the WM_PAINT thing works... I wonder how efficient it is? What do you think?

Btw, befor you wonder about the timer in pEngine->EngineMain(pEngine->m_timer->GetElapsedSeconds()). I use this timer to tell the rendering how many time has elapsed since last drawing. The EngineMain() function should update the object depending on time. I allready used this technique before to gain a CPU independent rendering.

Greets, Moak
GeneralRe: How does a modal dialog work? Workaround Pin
Joaquín M López Muñoz1-Jun-02 5:28
Joaquín M López Muñoz1-Jun-02 5:28 
AnswerRe: How does a modal dialog work (message pump)? Pin
Paul M Watt29-May-02 7:24
mentorPaul M Watt29-May-02 7:24 
GeneralFile Type Association Pin
moobob29-May-02 4:34
moobob29-May-02 4:34 
GeneralRe: File Type Association Pin
Mauricio Ritter29-May-02 6:27
Mauricio Ritter29-May-02 6:27 
GeneralRe: File Type Association Pin
moobob29-May-02 7:06
moobob29-May-02 7:06 
GeneralCombo box without dropdown button Pin
ed987129-May-02 4:03
ed987129-May-02 4:03 
GeneralRe: Combo box without dropdown button Pin
dlhson29-May-02 6:09
dlhson29-May-02 6:09 
GeneralRe: Combo box without dropdown button Pin
ed987129-May-02 7:15
ed987129-May-02 7:15 
GeneralRe: Combo box without dropdown button Pin
aldeba29-May-02 23:48
aldeba29-May-02 23:48 
GeneralConvert a HRESULT to a string Pin
Anders Molin29-May-02 3:32
professionalAnders Molin29-May-02 3:32 
GeneralRe: Convert a HRESULT to a string Pin
Philippe Mori29-May-02 3:49
Philippe Mori29-May-02 3:49 
GeneralRe: Convert a HRESULT to a string Pin
CodeGuy29-May-02 3:44
CodeGuy29-May-02 3:44 
GeneralSubclassing a static control Pin
Cathy29-May-02 3:03
Cathy29-May-02 3:03 
GeneralRe: Subclassing a static control Pin
Roger Allen29-May-02 4:58
Roger Allen29-May-02 4:58 
GeneralRe: Subclassing a static control Pin
Cathy29-May-02 11:45
Cathy29-May-02 11:45 
GeneralATL DLL-server problem Pin
Hans Ruck29-May-02 2:27
Hans Ruck29-May-02 2:27 
GeneralRe: ATL DLL-server problem Pin
[James Pullicino]29-May-02 4:48
[James Pullicino]29-May-02 4:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.