c++ - Center an OpenGL window with GLUT -


I have an open GL window which is 640x480 which I need to center in the center of the screen. I used previously:

  glutInitWindowPosition (GetSystemMetrics (SM_CXSCREEN) -640) / 2, (GetSystemMetrics (SM_CYSCREEN) -480) / 2);  

what worked

but now when I compile ...

  linking ... 1> Project1.obj: Error LNK2028: Unsolved Token (0A000372) "extern" function "int __cdcl main (int, four * *)" (? Main @@ $ $ hayapppad @ z) 1 & gt; Obj: Error LNK2019: Unsolved exotic symbol referenced in the function "int __cdecl main (int, char * *)", "extern", referenced in Project 1, "int __standard GetSystemMetrics (int)" (? GetSystemMetrics @@ $$ J14YGHH @ Z) C "int __stdcall GetSystemMetrics (int)" (GetSystemMetrics @@ $ $ J14YGHH @ Z) "(? Main @ @ $$ HiPPP @ Z) 1> C: \ user \ My Computer \ Document \ School Content \ CS445 \ Project1 \ Debug \ Project1.exe: Fatal error LNK1120: 2 unsolved embedded  

Any help please, it is very upset and disappointing because I Much is known about GL and GLUT.

In addition to this, add user32.lib Instead, you can use it completely glute:

  glutGet (GLUT_SCREEN_WIDTH) // returns the screen width  

and

So why are you dependent on

when you can be cross-platform?

< P> Therefore, your code will look:

  glutInitWindowPosition ((glutGet (GLUT_SCREEN_WIDTH) -640) / 2, (glugetgate (GLUT_SCREEN_HEIGHT) -480) / 2);  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -