Jump to content
  • Advertisement
Sign in to follow this  
Fire Lancer

OpenGL Full screen issues

This topic is 3098 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to add full screen support to a game, however Ive run into a problem with the game not using the entire screen. Instead their appears to be a "gap" around the right and bottom edges, which show the other windows below, and can even be clicked through with the mouse :( I've checked my code against a number of online resources but I cant see what I've done differently to cause this... Below is the code i'm using, minus a few things like error checking and getting config settings.
//----REGISTER WINDOW CLASS----//
WNDCLASSEX wndClass;
wndClass.cbSize         = sizeof(WNDCLASSEX);
wndClass.style          = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC;
wndClass.lpfnWndProc    = &wndProc;
wndClass.cbClsExtra     = 0;
wndClass.cbWndExtra     = 0;
wndClass.hInstance      = 0;//hInstance;
wndClass.hIcon          = LoadIcon(NULL, IDI_APPLICATION);
wndClass.hCursor        = LoadCursor(NULL, IDC_ARROW);
wndClass.hbrBackground  = (HBRUSH)(COLOR_WINDOW+1);
wndClass.lpszMenuName   = 0;
wndClass.lpszClassName  = "window";
wndClass.hIconSm        = LoadIcon(NULL, IDI_APPLICATION);

RegisterClassEx(&wndClass);

unsigned style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP | WS_SYSMENU;
unsigned styleEx = WS_EX_APPWINDOW;

DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize       =sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth  = wndSize.x;
dmScreenSettings.dmPelsHeight = wndSize.y;
dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL);
//CREATE WINDOW
hwnd = CreateWindowEx(
	styleEx,
	"window", gameName,
	style,
	-1,-1, wndSize.x,wndSize.y
	NULL,NULL, 0/*hInstance*/, NULL
	);

static	PIXELFORMATDESCRIPTOR pfd=
{
	sizeof(PIXELFORMATDESCRIPTOR),
	1,//version
	PFD_DRAW_TO_WINDOW | //must support the window
	PFD_SUPPORT_OPENGL | //must support openGL
	PFD_DOUBLEBUFFER,    //
	PFD_TYPE_RGBA,       //red green blue alpha
	32,//32 bit colour
	0, 0, 0, 0, 0, 0,//ignore colour bits
	0,//no alpha buffer
	0,//shift bits ignored
	0,//no acummalation buffer
	0, 0, 0, 0,//accumalation bits ignored
	0,//no z-buffer
	0,//no stencil buffer
	0,//no auxcillery buffer
	PFD_MAIN_PLANE,//main draing layer
	0,//reserved
	0, 0, 0//layer masks ignored
};
//get device context for window
hdc = GetDC(hwnd);
//try to find a support pixel format that does what we want
int pixelFormat=ChoosePixelFormat(hdc,&pfd);
SetPixelFormat(hdc,pixelFormat,&pfd);
//create an opengl rendering context
hrc = wglCreateContext(hdc);
//make it the active context
wglMakeCurrent(hdc,hrc);

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!