desp_cl
desp_cl

Reputation: 11

How does static linking opengl with glad work?

i use visual studio, and in all the tutorials on setting it up I have seen, they say to put opengl32.lib in the linker's additional dependencies. But where is opengl32.lib located? opengl32.dll is in my system32 folder, but I have not found opengl32.lib anywhere.

Now for glad. If glad is a function loader for opengl because the opengl32.lib that windows supplies is only version 1.1, then why did i need to include my useless opengl32.lib? And also, where do these functions come from? Theyre not in the old opengl32.lib. In looking it up, apparently glad loads opengl32.dll itself, so why did i include the opengl static lib? And is opengl32.dll also version 1.1? If so, where is glad loading the newer functions from?

Upvotes: 1

Views: 791

Answers (1)

Blindy
Blindy

Reputation: 67362

OpenGL is built incrementally, with all previous versions' functions included in the next version. So opengl32.lib loads the base 1.1 functions (glEnable etc), and the rest of the functions have to be manually loaded from the DLL, which is what your loader does.

opengl32.dll also version 1.1?

No, your graphics driver provides that DLL with all the functions it supports.

Upvotes: 2

Related Questions