PDA

View Full Version : How do I draw to the entire screen?



aktech
05-05-2004, 08:06 AM
I want to make a fullscreen drawing using OpenGL. Using GetDC() with NULL as the parameter while creating the rendering context doesn't seem to work (I don't think it is meant to be used that way). Please suggest some other means to do so.
Thanks!

plasmonster
05-05-2004, 06:21 PM
One way to get a fullscreen window is to create your window like this:


WNDCLASSEX cls;
ZeroMemory( &cls, sizeof(cls) );
cls.cbSize = sizeof(cls);
cls.style = CS_OWNDC;
cls.lpszClassName = "myWindowClassName";
cls.lpfnWndProc = myWindowProc;
cls.hInstance = hInstance;
cls.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
cls.hCursor = LoadCursor(NULL,IDC_ARROW);
cls.hIcon = 0; // whatever
cls.hIconSm = 0; // whatever
RegisterClassEx( &cls );

HWND hWnd = CreateWindowEx( WS_EX_TOPMOST,
"myWindowClassName",
"myTitle",
WS_VISIBLE | WS_POPUP,
0, 0,
GetSystemMetrics( SM_CXSCREEN ),
GetSystemMetrics( SM_CYSCREEN ),
NULL,
(HMENU)NULL,
hInstance,
(void*)NULL );

UpdateWindow(hWnd);

...
HDC hDC = GetDC( hWnd );
// now setup a gl render context using this dc.
...This would do if you are content to render in the current desktop resolution and color depth.