問題在你的視窗是誰建立的
是用glfw? glut? or ??
至於置中,就還簡單了
視窗的左上角位置 = 0.5 X( 桌面大小 - 視窗大小 )
// Open a window and create its OpenGL context
if( !glfwOpenWindow( width, height, 0,0,0,0, 0,0, GLFW_WINDOW ) ) {
fprintf( stderr, "Failed to open GLFW window\n" );
glfwTerminate();
exit( EXIT_FAILURE );
}
GLFWvidmode desktop;
glfwGetDesktopMode( &desktop );
int posX = 0.5 * ( desktop.Width - width );
int posY = 0.5 * ( desktop.Height - height );
glfwSetWindowPos( posX, posY );
沒有留言:
張貼留言