All pastes #828434 Raw Edit

Anonymous

public text v1 · immutable
#828434 ·published 2007-12-22 13:39 UTC
rendered paste body
	WNDCLASS wcWnd;
	wcWnd.cbClsExtra = 0;
	wcWnd.cbWndExtra = 0;
	wcWnd.hCursor = LoadCursor(0, IDC_ARROW);
	wcWnd.hIcon = LoadIcon(0, IDI_APPLICATION);
	wcWnd.hInstance = GetModuleHandle(0);
	wcWnd.hbrBackground = reinterpret_cast<HBRUSH>(0);
	wcWnd.lpfnWndProc = reinterpret_cast<WNDPROC>(WndProc);
	wcWnd.lpszClassName = "Weird";
	wcWnd.lpszMenuName = 0;
	wcWnd.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
	
	RegisterClass(&wcWnd);
	
	HWND hWnd = CreateWindow("Weird", "Titole", WS_POPUP, 0, 0, Width, Height, 0, 0, 0, 0);
	
	DEVMODE devScr;
	devScr.dmBitsPerPel = 32;
	devScr.dmPelsWidth = Width;
	devScr.dmPelsHeight = Height;
	devScr.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
	
	ChangeDisplaySettings(&devScr, CDS_FULLSCREEN);
	
	PIXELFORMATDESCRIPTOR pfdPix;
	pfdPix.nSize = sizeof(pfdPix);
	pfdPix.nVersion = 1; //! M$ SUCKS
	pfdPix.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER;
	pfdPix.cColorBits = 32;
	pfdPix.cDepthBits = 16;
	
	HDC hDc = GetDC(hWnd);
	int iPix = ChoosePixelFormat(hDc, &pfdPix);
	SetPixelFormat(hDc, iPix, &pfdPix);
	
	HGLRC hRc = wglCreateContext(hDc);
	wglMakeCurrent(hDc, hRc);
	
	ShowWindow(hWnd, SW_SHOW);
	
	glViewport(0, 0, Width, Height);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	glOrtho(0, Width, Height, 0, -1, 1);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();