PDA

View Full Version : wglSwapIntervalEXT doesn't work in my MFC project



Ehsan Kamrani
08-06-2008, 07:01 PM
Hi
I have used wglSwapIntervalEXT in my previous win32 project and it has worked correctly( it disabled the VSync )
But now, In my MFC project it doesn't disable VSync:

if( WGLEW_EXT_swap_control )
wglSwapIntervalEXT(0);

Note that I have used GLEW library, It has been initialized and I can recognize the OpenGL extensions( For example I'm currently using multisampling ). wglSwapIntervalEXT(0) is executed, but it doesn't change anything.
I have used MFC timer, I have set the timer with the following function:

SetTimer( 1, 1, 0 );

My application runs about 65 FPS, but my GPU supports this extension.I render simple objects with only 2000-3000 vertices. I don't use GLSL or any special effects.So something is going wrong...
BTW, my graphics card is Geforce 7300 GT
Any suggestions?
Regards
-Ehsan

ZbuffeR
08-07-2008, 06:48 PM
Vsync can be overrided on or off in the driver.
For example nvidia control panel has this option. You may want to check if this somthing like "force vsync", whereas it should be "application default".

Edit: But if this is a win32 versus MFC problem, I don't have any clue...

Ehsan Kamrani
08-07-2008, 09:53 PM
Yes, I had checked those settings before.
It seems that it's a question about MFC. the problem is that MFC timer loops about 65 times a second and its not like a while command which tries to loop as much as it can. I have discovered the problem, but I couldn't find a solution yet :(
Regards
Ehsan

V-man
08-07-2008, 10:07 PM
MFC is just a wrapper for Win32. If you are using SetTimer, then it has a resolution of about 50 ms or something like that. It generate WM_TIMER which takes time to process. You need to render in a loop just like you do in your non-MFC code.

Komat
08-08-2008, 01:32 AM
Maybe the OnIdle (http://msdn.microsoft.com/en-us/library/3e077sxt(VS.80).aspx) handler is what you need.