Fullscreen in OpenGL...

Started by
13 comments, last by ZaneX 23 years, 6 months ago
I won''t be able to get home in a little while, but it isn''t too complicated. Just make a call to glViewport after you call all the init stuff but before you set up your projection matrix. The glViewport call should be something like this:

glViewport( 0, 0, width, height );

Check the SDK info to make sure (I may have missed a parameter).
-----------------------------Mice are an excellent source of mice.
Advertisement
i recommend getting a tnt2/m64 or a vanta (ive one) not the fastest cards around (though i can still do more than 10000 tris at 20fps+ at 1152x864x16 so not to bad) also they are half the price of a voodoo3, and best of all the drivers are great
Remember that the Geforce MX is pretty cheap too , if you can get it into your system...



Edited by - Null and Void on October 6, 2000 8:25:57 PM
Just wanted to thank everybody for their responses....

I''ve managed to fix my problem, go figure... Win98

I don''t know if the problem was within the Win95 drivers for the Voodoo3 or if it was just the Win95 API that wasn''t supporting the function call properly... I don''t care anymore, everything works fine and how I wan''t it to work. Hence, I''m keeping my Voodoo3 (just don''t feel like going through the hassle of bringing it back and finding another card)

Even GLUT is being accelerated... Just a mistake on my part, I really didn''t think the keyboard handler was that slow... I added a frame rate and noticed it was being accelerated... my mistake...

Thanks again...

ZaneX...
I''m confused what you want now...but I''ll show you how to go full screen anyway. This code works with Voodoo3s because I had one when I made this code

    GLint glInitFullScreen(GLuint Width, GLuint Height, GLubyte ColorDepth, HWND* hwnd, HINSTANCE hInstance, WNDPROC WindowProc, char* AppName, char* Title, char* Message){	DEVMODE	devMode;	GLuint	Result;	char		sResolution[32];	char		sTemp[32];	itoa(Width, sTemp, 10);	strcpy(sResolution, sTemp);	strcat(sResolution, "x");	itoa(Height, sTemp, 10);	strcat(sResolution, sTemp);	strcat(sResolution, "x");	itoa(ColorDepth, sTemp, 10);	strcat(sResolution, sTemp);	memset(&devMode, 0,  sizeof(devMode));	devMode.dmSize = sizeof(devMode);	devMode.dmBitsPerPel = ColorDepth;	devMode.dmPelsWidth  = Width; 	devMode.dmPelsHeight = Height; 	devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL; 	Result=ChangeDisplaySettings(&devMode, CDS_FULLSCREEN);	switch(Result)	{		case DISP_CHANGE_SUCCESSFUL:			break;		case DISP_CHANGE_RESTART:			strcpy(Message, "You need to manually set the video res to ");			strcat(Message, sResolution);			return false;		case DISP_CHANGE_BADFLAGS:			strcpy(Message, "An invalid set of flags was passed in");			return false;		case DISP_CHANGE_BADPARAM:			strcpy(Message, "An invalid parameter was passed in");			return false;		case DISP_CHANGE_FAILED:			strcpy(Message, "The display driver failed the specified graphics mode ");			strcat(Message, sResolution);			return false;		case DISP_CHANGE_BADMODE:			strcpy(Message, "The graphics mode is not supported");			return false;		case DISP_CHANGE_NOTUPDATED:			strcpy(Message, "Windows NT: Unable to write settings to the registry");			return false;	}	WNDCLASS	wc;	wc.style = CS_HREDRAW | CS_VREDRAW;	wc.lpfnWndProc = WindowProc;	wc.cbClsExtra = 0;	wc.cbWndExtra = 0;	wc.hInstance = hInstance;	wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION);	wc.hCursor = LoadCursor(hInstance, IDC_ARROW);	wc.hbrBackground = NULL;	wc.lpszMenuName = NULL;	wc.lpszClassName = AppName;	RegisterClass(&wc);	*hwnd = CreateWindowEx(		//WS_EX_APPWINDOW,		WS_EX_TOPMOST,		AppName,		Title,		WS_POPUP,		0, 0,		Width,		Height,		NULL,		NULL,		hInstance,		NULL);	if (!*hwnd)	{		strcpy(Message, "Couldn''t create OpenGL window");		return false;	}	ShowWindow(*hwnd, SW_SHOWNORMAL);	UpdateWindow(*hwnd);	if (!glSetPixelFormat(ColorDepth, *hwnd))	{		strcpy(Message, "Couldn''t set the pixel format");		return false;	}	if(!(hGLRC = wglCreateContext(hDC)))	{		strcpy(Message, "Couldn''t create OpenGL context");		return false;	}	wglMakeCurrent(hDC, hGLRC);   return true;}    


If anything is clipped, and you can see the existing windows desktop, it''s because you set your viewport wrong.

This topic is closed to new replies.

Advertisement