glfw of hello world

On mac with cocoa do imshow, information seems easy to find, even if the need to find and OC mixed, rather than pure C. This is not pure. Consider imshow do with universal opengl, cross-platform. First entry about opengl, starting from the official examples glfw.

glfw version

3.3, based on the download source cmake + vs2017 (note specified CMAKE_PREFIX_INSTALL), Release mode, execute the INSTALL target.

Examples of official glfw

https://www.glfw.org/docs/latest/quick_guide.html

glad

Read the above examples of official documents, thought to manually download glad, in fact, later found glfw source code example/simple.cand deps/glad_gl.c, put these two files in the src directory of the new project can be.

cmake脚本
CMakeLists.txt:

cmake_minimum_required(VERSION 3.14)

project(opengl_imshow)

include_directories(
    "F:/zhangzhuo/dev/glfw-3.3/build/vs2017-x64/install/include"
    "F:/zhangzhuo/dev/glfw-3.3/deps"
    "F:/zhangzhuo/dev/glad/include"
)
link_directories("F:/zhangzhuo/dev/glfw-3.3/build/vs2017-x64/install/lib")

add_executable(imshow
    src/simple.c
    src/glad_gl.c
)

#target_link_libraries(imshow glfw3 glfw3dll opengl32)
target_link_libraries(imshow glfw3 opengl32)

operation result:

Guess you like

Origin www.cnblogs.com/zjutzz/p/10978385.html