網上源碼我不知道,這些聲稱本身編譯了freeglut他們是怎麼在vs下編譯的freeglut。我沒法編譯成功,多是我比較笨吧,最後不得不改動freeglut代碼,完成了編譯,並經過了例子功能測試。我仔細看了一下,glutInit( int* pargc, char** argv ) 函數內部並無作平臺相關的ifdef,也就是說全部的平臺都會要求實現int mask = XParseGeometry( geometry, &fgState.Position.X, &fgState.Position.Y, &parsedWidth, &parsedHeight );這顯然是個xwindow的下的XLib函數,在windows下沒有對應接口函數。我把這部分註釋掉了。vs完成了編譯,也經過了例子測試。git
fgPlatformInitialize( displayName );windows
/*
* Geometry parsing deferred until here because we may need the screen
* size.
*/函數
if (geometry )
{
unsigned int parsedWidth, parsedHeight;
/*int mask = XParseGeometry( geometry,
&fgState.Position.X, &fgState.Position.Y,
&parsedWidth, &parsedHeight );*/
/* TODO: Check for overflow? */
fgState.Size.X = parsedWidth;
fgState.Size.Y = parsedHeight;
/*
if( (mask & (WidthValue|HeightValue)) == (WidthValue|HeightValue) )
fgState.Size.Use = GL_TRUE;測試
if( mask & XNegative )
fgState.Position.X += fgDisplay.ScreenWidth - fgState.Size.X;orm
if( mask & YNegative )
fgState.Position.Y += fgDisplay.ScreenHeight - fgState.Size.Y;接口
if( (mask & (XValue|YValue)) == (XValue|YValue) )
fgState.Position.Use = GL_TRUE;*/
}
}源碼
https://gitee.com/niuzhez 能夠找到對應的vs2013的sln工程,與部分opengl例子。it