Jump to content
  • Advertisement
Sign in to follow this  
wlb2001

OpenGL Opengl vsync

This topic is 3019 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi: Yesterday I have read an artical about how to implement vsync by DirectDraw,even use the opengl for rendering api. I was wandering is that possible? #include <ddraw.h> #pragma comment(lib,"ddraw.lib") //before create opengl render context HRESULT hr = DirectDrawCreateEx(NULL, (VOID**)&m_pDD, IID_IDirectDraw7, NULL); DDSURFACEDESC2 ddsd; DDSCAPS2 ddscaps; m_pDD->SetCooperativeLevel(m_hWnd, DDSCL_NORMAL ); memset(&ddsd, 0, sizeof(ddsd)); // Set all fields of struct to 0 and set .dwSize to ddsd.dwSize = sizeof(ddsd); // Sizeof the variable - these two steps required for most DDraw structs ddsd.dwFlags = DDSD_CAPS; // Set flags for variables we're using... ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; // Set the variables we said we would in dwFlags hr = m_pDD->CreateSurface(&ddsd, &m_pDDSPrimary, NULL); //on draw m_pDD->WaitForVerticalBlank( DDWAITVB_BLOCKBEGIN, NULL); SwapBuffers( m_hdc ); //on destroy if( m_pDDSPrimary ) m_pDDSPrimary->Release(); m_pDDSPrimary = NULL; if( m_pDD ) m_pDD->Release(); m_pDD = NULL; Anyway I have tried and faild, Does I miss something or it's just not possible? Thanks for your help!

Share this post


Link to post
Share on other sites
Advertisement
What article are you referring to? I don't think it's possible to use direct draw to get vertical sync in OpenGL. Use wglSwapInterval instead.

Share this post


Link to post
Share on other sites
Yeah, I know wglSwapInterval works.I just worndering how to do this by direct draw,and the artical says by using directdraw you get the extra benifit which is to support "true" full screen.(which probably means the difference between opengl and d3d when you press alt+tab) Anyway the artical isn't in english, that's why i do not post the link.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!