Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

start-learning-opengl

> 编程语言
Open source

Learn opengl together

369 stars0 likes2 views
WebsiteGitHub

About

Learn opengl together

参考

  • windows 需安装 MinGW, install gcc、g++、gdb 和 mingw32-make 并 进入到 MinGW\bin 文件夹下 把 mingw32-make.exe 修改成 make.exe

    MinGW 不要下载 MinGW-w64因为后面可能会出现问题 MinGW,即 Minimalist GNU For Windows。它是一些头文件和端口库的集合,该集合允许人们在没有第三方动态链接库的情况下使用 GCC 产生 Win32 程序。

  • vscode 插件 C/C++、C/C++ Project Generator

  • glfw 下载 Windows pre-compiled binaries

    选择Windows pre-compiled binaries,因为我们使用的 MinGW 所以选择 32-bit Windows binaries 对于 Ubuntu,通过 sudo apt install libglfw3-dev libglfw3 安装 glfw

  • glad 在线服务 生成静态库

    > gcc ./src/glad.c -c -I ./include/ // 生成 .o文件
    > ar -rc libglad.a glad.o           // 生成我们所需要的 .a文件

    将生成的 libglad.a 复制到 lib 文件下

  • glm 复制到 include 目录下

  • imgui 复制到 include 目下,Makefile 中添加以下命令

    mk
    # define the C source files
    SOURCES        := $(wildcard $(patsubst %,%/*.cpp, $(SOURCEDIRS)))
    SOURCES    += include/imgui/imgui_impl_glfw.cpp include/imgui/imgui_impl_opengl3.cpp
    SOURCES    += include/imgui/imgui.cpp include/imgui/imgui_demo.cpp include/imgui/imgui_draw.cpp include/imgui/imgui_widgets.cpp
  • assimp 下载已编译好的文件 Assimp3-1-1_MinGW4-8-1_Win32.zip

    对于 Ubuntu,通过 sudo apt install libassimp-dev 安装 assimp

  • 参考 Makefile 文件

示例

1. Run 和 Clean

测试代码

…

执行命令 run 编译和运行.exe 程序

bash
make run dir=01_test_glfw

执行命令 clean 删除 .exe 和对应文件夹下的.o 文件

bash
make clean dir=01_test_glfw

2. Debug

需要设置调试一个文件 修改 tasks.json下面的条目

javascript
 "label": "build",
  "type": "shell",
  "group": {
      "kind": "build",
      "isDefault": true
  },
  "windows": {
      "command": "powershell",
      "args": [
          "-c",
          "make dir=01_test_glfw", // 调式 01_test_glfw/main.cpp
      ]
  },

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言