Sprache: C++
VSync ist die Abkürzung Vertical synchronization. Zu deutsch "Vertikale Synchronisierung" und verhindert Darstellungsfehler im Bildaufbau. Das folgende Code Fragment zeigt wie man unter OpenGL VSync an- bzw. abschalten kann.
Quellen:
1. VSync – Wikipedia: http://de.wikipedia.org/wiki/VSync
2. 60, 70 or 75 fps? See the solution ! (Source code to copy and paste.) – Gamedev.net: http://www.gamedev.net/community/forums/topic.asp?topic_id=425122
//Download wglext.h from http://oss.sgi.com/projects/ogl-sample/sdk.html
#include <glwglext.h>
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = NULL;
//from NeHe Lesson 45
bool IsExtensionSupported( char* szTargetExtension )
{
const unsigned char *pszExtensions = NULL;
const unsigned char *pszStart;
unsigned char *pszWhere, *pszTerminator;
// Extension names should not have spaces
pszWhere = (unsigned char *) strchr( szTargetExtension, ' ' );
if( pszWhere || *szTargetExtension == '