Advertisement

flashing border at the bottom of the screen

Started by March 10, 2003 10:12 AM
-1 comments, last by ranmer 21 years, 11 months ago
I've modified NeHe's code in lesson 6 so that pressing F2 reduces the resolution (minimum of 640x480) and pressing F3 increases the resolution (maximum of 1024x768). When I press F3 enough to make the resolution go to max. (the highest my monitor supports and the res. that Windows is set to), there is a grey flickering line at the bottom of the screen. I've included the key changes to the code. Please someone tell me how to correct this. . . . #define VMODE_640X480 0 #define VMODE_800X600 1 #define VMODE_1024X768 2 . . . GLuint vmode = VMODE_800X600; // Video resolution . . . BOOL InitVMode(char* title, int mode, int bits, bool fullscreenflag) { switch (mode) { case VMODE_640X480: if (!CreateGLWindow (title, 640, 480, bits, fullscreenflag)){ return FALSE; } break; case VMODE_800X600: if (!CreateGLWindow (title, 800, 600, bits, fullscreenflag)){ return FALSE; } break; case VMODE_1024X768: if (!CreateGLWindow (title, 1024, 768, bits, fullscreenflag)){ return FALSE; } break; default: return FALSE; } return TRUE; } . . . int WINAPI WinMain( HINSTANCE hInstance, // Instance HINSTANCE hPrevInstance, // Previous Instance LPSTR lpCmdLine, // Command Line Parameters int nCmdShow) // Window Show State { MSG msg; // Windows Message Structure BOOL done=FALSE; // Bool Variable To Exit Loop // Create Our OpenGL Window if (!CreateGLWindow("NeHe's OpenGL Framework",800,600,16,fullscreen)) { return 0; // Quit If Window Was Not Created } while(!done) // Loop That Runs Until done=TRUE { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting? { if (msg.message==WM_QUIT) // Have We Received A Quit Message? { done=TRUE; // If So done=TRUE } else // If Not, Deal With Window Messages { TranslateMessage(&msg); // Translate The Message DispatchMessage(&msg); // Dispatch The Message } } else // If There Are No Messages { // Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene() if (active) // Program Active? { if (keys[VK_ESCAPE]) // Was ESC Pressed? { done=TRUE; // ESC Signalled A Quit } else // Not Time To Quit, Update Screen { DrawGLScene(); // Draw The Scene SwapBuffers(hDC); // Swap Buffers (Double Buffering) } } if (keys[VK_F1]) // Is F1 Being Pressed? { keys[VK_F1]=FALSE; // If So Make Key FALSE KillGLWindow(); // Kill Our Current Window fullscreen=!fullscreen; // Toggle Fullscreen / Windowed Mode // Recreate Our OpenGL Window if (!InitVMode("NeHe's OpenGL Framework",vmode,16,fullscreen)) { return 0; // Quit If Window Was Not Created } } if (keys[VK_F2]) { keys[VK_F2]=FALSE; if (vmode > VMODE_640X480) { vmode--; KillGLWindow(); if (!InitVMode("NeHe's OpenGL Framework", vmode, 16, fullscreen)) { return 0; } } } if (keys[VK_F3]) { keys[VK_F3]=FALSE; if (vmode < VMODE_1024X768) { vmode++; KillGLWindow(); if (!InitVMode("NeHe's OpenGL Framework", vmode, 16, fullscreen)) { return 0; } } } } } // Shutdown KillGLWindow(); // Kill The Window return (msg.wParam); // Exit The Program } [edited by - ranmer on March 10, 2003 6:27:13 PM]

This topic is closed to new replies.

Advertisement