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.
本文深入讲解了如何在Win32平台上设置OpenGL渲染上下文,详细介绍了使用AdjustWindowRectEx函数调整窗口大小以匹配应用程序所需的客户端区域尺寸的过程。文章提供了完整的源代码下载链接,并针对Visual Studio 2008中glaux库缺失的问题给出了解决方案。

被折叠的 条评论
为什么被折叠?



