Ok, first of all, I'm not sure if this belongs to C section. Since WinAPI is written in C, I'll post here. I'm using OpenGL with Win32 windows (not sure how to call that). I can't switch to fullscreen mode after creating the window. I'm using Windows 7 (64-bits) and VS 2008. Here's the part of the code where I switch to fullscreen mode:
DEVMODE dmScreenSettings;
// ...
if(ContextPtr->Fullscreen)
{
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = ContextPtr->ScreenWidth;
dmScreenSettings.dmPelsHeight = ContextPtr->ScreenHeight;
dmScreenSettings.dmBitsPerPel = ContextPtr->ScreenDepth;
dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
if(ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
{
ContextPtr->Fullscreen = false;
}
}
I've tried copying some code from SDL (SDL_dibvideo.c), but it didn't work either. There's a similar example in some book on games development:
(the link was a bit long)
Need help :)
Thanks