How do I draw to the entire screen?

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!

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.