Hello,
i switched from Android Studio/OpenGL (Java) to Windows Open GL.
(Eclipse IDE C++, MinGW, Freeglut)
The App is running good, except for the vsync trouble.
It seems to be an old problem, since i searched the net about it (for nearly two month).
I found a lot of discussion about this problem, but there was not a solution included.
In Windowed Mode, the Game runs perfect…but when going to Fullscreen Mode,
the vsync is not working.
i miss something like the wglSwapIntervalEXT (1)
did i have to add something to the project? (and where to get that)
or did freeglut / glutGameMode doing the vsync job?
(when calling, this is always crashing , cause no second screen configured message, and other mode problems)
i don’t need a lot of frames… even 40fps are more than enough for this project
but with this flickering i cannot show my project to anybody
greeting and much thanks
#define GLEW_STATIC
#include <GL/glew.h>
#pragma comment( lib, "glew32s.lib" )
#include <GL/glut.h>
#include <GL/glu.h>
...
.....................................................
if (glewIsSupported("GL_VERSION_3_0")) {
cout << "GL_VERSION_3_0 : supported" << '
'; // Works
}
--------------------------------------
in Main Render Loop
glFinish(); //with or without its flickering
glutSwapBuffers();
.......................................................
alternate fullscreen code
if (IsWindowMode) {
IsWindowMode = FALSE;
GetWindowPlacement(hThisWnd, &wpc);
if (HWNDStyle == 0)
HWNDStyle = GetWindowLong(hThisWnd, GWL_STYLE);
if (HWNDStyleEx == 0)
HWNDStyleEx = GetWindowLong(hThisWnd, GWL_EXSTYLE);
LONG NewHWNDStyle = HWNDStyle;
NewHWNDStyle &= ~WS_BORDER;
NewHWNDStyle &= ~WS_DLGFRAME;
NewHWNDStyle &= ~WS_THICKFRAME;
LONG NewHWNDStyleEx = HWNDStyleEx;
NewHWNDStyleEx &= ~WS_EX_WINDOWEDGE;
SetWindowLong(hThisWnd, GWL_STYLE, NewHWNDStyle);
SetWindowLong(hThisWnd, GWL_EXSTYLE, NewHWNDStyleEx | WS_EX_TOPMOST);
ShowWindow(hThisWnd, SW_SHOWMAXIMIZED);
} else {
IsWindowMode = TRUE;
SetWindowLong(hThisWnd, GWL_STYLE, HWNDStyle);
SetWindowLong(hThisWnd, GWL_EXSTYLE, HWNDStyleEx);
ShowWindow(hThisWnd, SW_SHOWNORMAL);
SetWindowPlacement(hThisWnd, &wpc);
}