NeHe OpenGL Lesson01 – Creating an OpenGL Window (Win32)

lesson01_screen_shot-300x238 I started learn NeHe OpenGL lessons in university, but I never went though all of his lessons. I wish this time my blog will go though all of content, and figure out all of the OpenGL technology points that NeHe tutorial used.

Creating an OpenGL Window : shows us how to set up the OpenGL rendering context on win32 windows. Those are fixed steps that nothing special to take care. One thing need to mention is the function “AdjustWindowRectEx“, this function will adjust the window to the requested size. Usually, when you create a size 800×600 window, the client area that could be used by the application is less than 800×600. Because this area (800×600) you requested includes the window borders, the caption item(the top most part of the window, that used to hold the window title, max/min/close button), and the client area. With this function, you could calculate the real window size given by specified client area size.

The full source code could be downloaded from here. And the PDF tutorial could be downloaded from here.

Note, there is no “glaux” library and header files any more on Visual Studio 2008. To make the vs2008 compile this project well, you need to grab this library back(you could grab it from vs2005 install directory). Or you could download a copy from here. You need to put glaux.h to folder “C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl\“, and put GlAux.Lib to folder “C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\“.  If you use vs2005, there is no such problem.

posted @ 2012-08-23 23:12  opencoder  阅读(304)  评论(0编辑  收藏  举报