NeHe OpenGL Lesson01 – Creating an OpenGL Window (Win32)

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.

转载于:https://www.cnblogs.com/open-coder/archive/2012/08/23/2653437.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值