Windows 操作系统搭建 VS Code/Visual Studio + OpenGL 环境

OpenGL (Open Graphics Library)

A cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardware-accelerated rendering.

“However, OpenGL by itself is not an API, but merely a specification, developed and maintained by the Khronos Group.” – from learnopengl.com

学习 OpenGL 最好的教程:
LearnOpenGL
LearnOpenGL-CN

参考配置

  • 操作系统:Windows 10 64-bit
  • 系统架构:x64-based PC
  • 编译工具:CMake
  • OpenGL 应用框架:GLFW
  • 访问 OpenGL 规范接口的第三方库:GLAD
  • [Option 1]
    • 编译器:MinGW-W64
    • 编辑器:Visual Studio Code
  • [Option 2]
    • 编译器:MSVC
    • 集成开发环境:Visual Studio 2022

💡 NOTE:

需要提前安装好 CMake,另外:

  • 选择 [Option 1] 需要提前安装好 MinGW-W64 和 VS Code
  • 选择 [Option 2] 需要提前安装好 Visual Studio

安装 MinGW-w64 与 CMake 可以参考我的上一篇博客 Windows 下 MinGW-W64 与 CMake 的安装

构建 GLFW

GLFW 提供创建 OpenGL Context 和用于显示的窗口、鼠标键盘等操作等接口,否则你需要自己写大量操作系统相关的代码来完成这些工作,因为在不同操作系统上这些操作不同,OpenGL 将它们抽象出去。

访问 GLFW GitHub Releases 页面,选择最新版本 源代码 压缩包 Source code (zip) 下载,或者 GLFW 官方下载页面 点击 Source package 直接下载最新版本 源代码 压缩包 glfw-<latest-version>.zip

💡 NOTE: 从源代码编译库可以保证生成的库是兼容你的操作系统和 CPU 的,而预编译的二进制文件可能会出现兼容问题(甚至有时候没提供支持你系统的文件)。

下载源码包之后,将其解压并打开。我们只需要里面的这些内容:

  • 编译生成的库
  • include 文件夹
  1. 创建一个单独的文件夹,里面包含 Libs 和 Inclu
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值