Advertisement

OpenGL windows init more simple

Started by August 26, 2002 02:58 PM
4 comments, last by KILE 22 years, 6 months ago
Hi all. I''m developing a 4kb intro using opengl and c++. I want to know if there''re another way to create an opengl windows than the code that I poste here. Beceause this code grow a lot my final exe. Thanks to all //------------------------------------------------------------------------- // CREATING OPENGL WINDOWS //------------------------------------------------------------------------- WNDCLASS wc; DWORD dwExnostyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; DWORD dwStyle = WS_OVERLAPPEDWINDOW; RECT WindowRect; WindowRect.left=(long)0; WindowRect.right=(long)width; WindowRect.top=(long)0; WindowRect.bottom=(long)height; wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon( NULL, IDI_APPLICATION ); wc.hCursor = LoadCursor( NULL, IDC_ARROW ); wc.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH ); wc.lpszMenuName = NULL; wc.lpszClassName = "GL"; RegisterClass(&wc); DEVMODE dmScreenSettings; memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); dmScreenSettings.dmSize=sizeof(dmScreenSettings); dmScreenSettings.dmPelsWidth = width; dmScreenSettings.dmPelsHeight = height; dmScreenSettings.dmBitsPerPel = 32; dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN); dwExnostyle=WS_EX_APPWINDOW; dwnostyle=WS_POPUP; ShowCursor(FALSE); AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); hWnd=CreateWindowEx( dwExStyle, "GL", "Ak", WS_CLIPSIBLINGS | WS_CLIPCHILDREN | dwStyle, 0, 0, WindowRect.right-WindowRect.left, WindowRect.bottom-WindowRect.top, NULL, NULL, hInstance, NULL) ; // set the pixel format for the DC PIXELFORMATDESCRIPTOR pfd; ZeroMemory( &pfd, sizeof( pfd ) ); pfd.nSize = sizeof( pfd ); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 24; pfd.cDepthBits = 16; pfd.iLayerType = PFD_MAIN_PLANE; int iFormat = ChoosePixelFormat(hDC, &pfd ); // exit if failure... SetPixelFormat(hDC, iFormat, &pfd ); hRC = wglCreateContext(hDC); wglMakeCurrent(hDC, hRC); ShowWindow(hWnd, SW_SHOW); SetForegroundWindow(hWnd); SetFocus(hWnd);
SUCKER, DONT CROSSPOST! i''ve replied you on opengl.org..

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Advertisement
Not sure about this, but maybe try SDL?
------------------------"If it says it loves me, how can it be a virus?"
Seen this yet?
LOL @ the thought of using SDL...

Try x86 ASM. Download the first NeHe tut (there''s a port to Win32 x86 ASM), and see what you learn. That combined with UPX should be enough to squeeze you under 4KB and have a little room left for some cool effects.

Peace,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[twitter]warrenm[/twitter]

I just said SDL cause I remember someone saying it had stuff in there for windows, atleast I think it was SDL. I prefer to just write my own code though instead of using a library like that.
------------------------"If it says it loves me, how can it be a virus?"

This topic is closed to new replies.

Advertisement