Archived

This topic is now archived and is closed to further replies.

ZaneX

OpenGL Fullscreen in OpenGL...

Recommended Posts

I've posted this already on NeHe's Forum, but getting little response (I still apreciate the help giving to me by those who have) but I find that I need more input, so if anybody else can help out It would really be appreciated. The problem is already stated here: Fullscreen in OpenGL... I really need to know how to get this working, otherwise I might be forced to bring back my video card. I really want fullscreen OpenGL w/ acceleration WITHOUT having to change my desktops bit depth to 16bpp. All comments are appreciated! ZaneX Edited by - ZaneX on 10/4/00 7:20:38 AM

Share this post


Link to post
Share on other sites
The best way I am aware of with Windows and OpenGL is to create your window with CreateWindowEx and use the WS_EX_TOPMOST flag. Then you set the width and height to that of the screen with GetSytemMetrics();

Share this post


Link to post
Share on other sites
The NeHe Tuts explain very well how to set fullscreen mode
I think its the SetDeviceMode or something like that function
It should set the bitdepth for you without worrying about desktop settings. It works for me.

Chris

Share this post


Link to post
Share on other sites
TheLabRat... NeHe''s tutorials are great and do explain it well, but I have a problem with his frame work, my Voodoo3 3000 doesn''t want to go to fullscreen mode for some reason, and it should, at least I can''t see why not. Anyways, I should have more time this weekend to fool around with the code and I''m hoping that Win98 will fix the problem (I''m still running 95). If you''re more curious on what is happening, the thread in NeHe''s forum explains more in detail to what I''ve been going through...

ZaneX

Share this post


Link to post
Share on other sites
I suppose it''s an obvious piece of advice, but are you running the latest drivers - if you''re running beta drivers this might be a problem.
I have a Voodoo3 as well, and with the original drivers, opengl would not accelerate at all. I downloaded later drivers and all problems were fixed. Unfortunately, 3dfx make very big downloads.
Sorry if this is patronistic

Chris

Share this post


Link to post
Share on other sites
There is a Win32 API function to change the color depth of the display without using DirectX, I think. Look at the Resolution Switching Without using DirectX article, although your game will now not work with Win95 before version a because it cannot change color depth without restarting. You might just have to change your desktop color depth.

------------------------------
#pragma twice


sharewaregames.20m.com

Share this post


Link to post
Share on other sites
Bringing back your video card would be a perfect idea anyway ! 3Dfx has the worst OpenGL drivers in the history of computer gfx, so you are really out of luck if you are trying to code anything GL for that card...

Tim

--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity

Share this post


Link to post
Share on other sites
Ya I could bring it back, but what am I suppose to get??? I need a PCI card 'cause I don't have the money to upgrade my system. I'm also limited to a 130$(US) price range!

ZaneX

Edited by - ZaneX on October 6, 2000 12:24:46 PM

Share this post


Link to post
Share on other sites
I''m not sure if this helps, but I''ve been doing some OpenGL coding for a Voodoo3 and I had some problems that sound similar to yours. The basic problem was that is wasn''t properly changing screen resolution (the scene would be clipped). I fixed this by changing the location of my call to glViewport. When you first bind the OpenGL rendering context to your window it assumes the width and height of the current context (the desktop) as your viewport. Then it would change the screen resolution to 800 by 600 or whatever, so the two values would be misaligned. By adding your call to glViewport after your initial OpenGL setup you can set it right again.

This fixed my problem, but you may be facing something else entirely.

Share this post


Link to post
Share on other sites
Jo...

It does sound like I have the same problem... I'll give your solution a try, hopefully it'll work. (If you could spare a framework of your source, it would save me some time)

ZaneX


Edited by - ZaneX on October 6, 2000 2:24:31 PM

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites