官术网_书友最值得收藏!

Adding an OpenGL loader

There is some external code that this chapter depends on, called glad. When you create a new OpenGL context on Windows, it's created with a legacy OpenGL context. The extension mechanism of OpenGL will let you use this legacy context to create a new modern context.

Once the modern context is created, you will need to get function pointers to all OpenGL functions. The functions need to be loaded with wglGetProcAdress, which returns a function pointer.

Loading every OpenGL function in this fashion would be very time-consuming. This is where having an OpenGL loader comes in; glad will do all this work for you. An OpenGL loader is a library or some code that calls wglGetProcAdress on the functions that the OpenGL API defines.

There are several OpenGL loaders available on Windows.; this book will use glad. glad is a small library that consists of only a few files. It has a simple API; you call one function and get access to all the OpenGL functions. glad has a web-based interface; you can find it at https://glad.dav1d.de/.

Important note

When using an X Windows system, such as many popular Linux distributions, the function to load OpenGL functions is glXGetProcAddress. As with Windows, there are OpenGL loaders available for Linux as well. Not all OSes need an OpenGL loader; for example, macOS, iOS, and Android don't need a loader. Both iOS and Android run on OpenGL ES.

主站蜘蛛池模板: 蒲江县| 金堂县| 兰州市| 社会| 甘德县| 全州县| 延长县| 绥阳县| 西昌市| 彰化县| 晋州市| 华宁县| 潜山县| 内丘县| 扬州市| 盐边县| 龙游县| 德阳市| 娄烦县| 广东省| 准格尔旗| 石柱| 枣阳市| 隆子县| 柳林县| 年辖:市辖区| 通许县| 于田县| 丹东市| 鹰潭市| 海伦市| 盱眙县| 五河县| 邹平县| 巩义市| 宿迁市| 深水埗区| 新巴尔虎左旗| 根河市| 金阳县| 济阳县|