Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Fullscreen


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Steve Scott   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 September 2001 - 02:01 PM

I have a funnction that is called from WinMain that is supposed to setup the window and make the program run in fullscreen. I pass the fullscreen size down to the function, but when I run the program the window just popsup in the specified size, rather than changing the screen resolution and becoming fullscreen. What could be going wrong? Thanks, Steve /*********************************************************************************/ /********************************* CREATE FULLSCREEN WINDOW **********************/ BOOL SetWindow(int width, int height,int bpp) { WNDCLASSEX wndclass; GLuint nPixelFormat; DWORD dwExStyle; DWORD dwStyle; g_hInstance = GetModuleHandle(NULL); //Register the Window Class wndclass.cbSize = sizeof(wndclass); wndclass.style = CS_HREDRAW|CS_VREDRAW|CS_OWNDC; wndclass.lpfnWndProc = (WNDPROC)WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = g_hInstance; wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); wndclass.hCursor = LoadCursor(NULL,IDC_ARROW); wndclass.hbrBackground = NULL; wndclass.lpszMenuName = NULL; wndclass.lpszClassName = _szAppName; wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION); //Register the Window Class if (!RegisterClassEx(&wndclass)) return FALSE; //Setup the Window for Fullscreen DEVMODE dmFullScreen; memset(&dmFullScreen,0,sizeof(dmFullScreen)); dmFullScreen.dmSize = sizeof(dmFullScreen); dmFullScreen.dmPelsWidth = width; dmFullScreen.dmPelsHeight = height; dmFullScreen.dmPelsHeight = bpp; dmFullScreen.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; ChangeDisplaySettings(&dmFullScreen, CDS_FULLSCREEN); dwExStyle = WS_EX_APPWINDOW; dwStyle = WS_POPUP; ShowCursor(FALSE); //Set the Window to 0,0,width,height RECT windowRect; windowRect.left = (LONG) 0; windowRect.right = (LONG) width; windowRect.top = (LONG) 0; windowRect.bottom = (LONG) height; AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle); //Create the Window g_hwnd = CreateWindowEx(dwExStyle, //Extended Style _szAppName, //Class Name _szAppName, //App Name dwStyle | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0,0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, NULL, NULL, g_hInstance, NULL); if (!g_hwnd) return 0; //Make sure we have the handle static PIXELFORMATDESCRIPTOR pfdPixel = { sizeof(PIXELFORMATDESCRIPTOR), //Structure Size 1, //default Version PFD_DRAW_TO_WINDOW | //Draw Mode PFD_SUPPORT_OPENGL | //Support OGL PFD_DOUBLEBUFFER, //Support DoubleBuffering PFD_TYPE_RGBA, //Color Mode bpp, //Bits 0,0,0,0,0, 0, //No Alpha Buffer 0, //No Shift Bit 0, //No Accumulation Buffer 0,0,0,0, //Therefore Ignore Accumulation Bits 16, //Stencil Buffer Size 0, //No Stencil Buffer 0, //No Auxiliary Buffer PFD_MAIN_PLANE, //Main Drawing Plane 0, //***RESERVED*** 0,0,0}; //No Layer Masks g_hDC=GetDC(g_hwnd); //Get a Device Context nPixelFormat = ChoosePixelFormat(g_hDC, &pfdPixel); //Choose PixelFormat Descriptor SetPixelFormat(g_hDC, nPixelFormat, &pfdPixel); //Set the Pixel Format g_hRC=wglCreateContext(g_hDC); //Create Rendering Context wglMakeCurrent(g_hDC,g_hRC); //Make Rendering Context Current ShowWindow(g_hwnd,SW_SHOW); //Display Window SetForegroundWindow(g_hwnd); SetFocus(g_hwnd); Resize(width, height); InitalizeGL(); //Initalize GL Options return TRUE; }

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS