GLEW (The OpenGL Extension Wrangler Library)

repository·master·Indexed 25 days ago

https://github.com/nigels-com/glew

A cross-platform C/C++ library that acts as an OpenGL extension wrangler, providing a single header to access OpenGL core and extension functionality and determining runtime support for extensions. Compatible with Windows, Linux, Mac OS X, FreeBSD, Irix, and Solaris. Current release is 2.3.1.

Tokens
1.3K
Snippets
4
Records
11
Agent score
82%

What's inside GLEW

  1. Overview of GLEW

    master
    GLEW (The OpenGL Extension Wrangler Library) is a cross-platform, open-source C/C++ library used for loading OpenGL extensions. It provides efficient run-time mechanisms to determine which OpenGL extensions are supported on a target platform. All OpenGL core and extension functionality is exposed through a single header file. It is compatible with Windows, Linux, Mac OS X, FreeBSD, Irix, and Solaris.
  2. Build GLEW on Windows

    master

    Visual Studio

    Use the provided Visual Studio project files located in build/vc15/. Projects for vc6, vc10, vc12, and vc14 are also provided.

    MSYS/Mingw

    Requires bash, make, and gcc.

    $ mingw32-make
    $ mingw32-make install
    $ mingw32-make install.all

    Alternative toolchain: SYSTEM=mingw-win32

    MSYS2/Mingw-w64

    Requires bash, make, and gcc.

    $ pacman -S gcc make mingw-w64-i686-gcc mingw-w64-x86_64-gcc
    $ make
    $ make install
    $ make install.all

    Alternative toolchains: SYSTEM=msys, SYSTEM=msys-win32, or SYSTEM=msys-win64

    $ mingw32-make
    $ mingw32-make install
  3. Build GLEW on Linux with specific backends

    master

    When using GNU Make on Linux, you can specify different backends using the SYSTEM variable:

    Linux EGL:

    $ sudo apt install libegl1-mesa-dev
    $ make SYSTEM=linux-egl

    Linux OSMesa:

    $ sudo apt install libosmesa-dev
    $ make SYSTEM=linux-osmesa

    Linux mingw-w64:

    $ sudo apt install mingw-w64
    $ make SYSTEM=linux-mingw32
    $ make SYSTEM=linux-mingw64
    $ make SYSTEM=linux-egl
  4. Build GLEW using CMake

    master

    The CMake build is maintained on a best-effort basis and requires CMake 3.16 or higher.

    1. Install build tools

    Debian/Ubuntu/Mint:

    $ sudo apt-get install build-essential libxmu-dev libxi-dev libgl-dev cmake git

    RedHat/CentOS/Fedora:

    $ sudo yum install libXmu-devel libXi-devel libGL-devel cmake git

    2. Build

    $ cd build
    $ cmake ./cmake
    $ make -j4

    CMake Targets

    • glew: Build the glew shared library.
    • glew_s: Build the glew static library.
    • glewinfo: Build the glewinfo executable (requires BUILD_UTILS=ON).
    • visualinfo: Build the visualinfo executable (requires BUILD_UTILS=ON).
    • install: Install targets into CMAKE_INSTALL_PREFIX.
    • clean: Clean build artifacts.
    • all: Build all enabled targets.

    CMake Variables

    • BUILD_UTILS: Build glewinfo and visualinfo.
    • GLEW_REGAL: Build in Regal mode.
    • GLEW_OSMESA: Build in off-screen Mesa mode.
    • BUILD_FRAMEWORK: Build as MacOSX Framework (set CMAKE_INSTALL_PREFIX to /Library/Frameworks).
    • CLANG_TIDY: Enable clang-tidy linting mode.
  5. Build GLEW on Linux and Mac using GNU Make

    master

    GNU make is the primary build system. It is recommended to build from a tgz or zip release snapshot. Note that you may need to run make in the auto folder first.

    1. Install build tools

    Debian/Ubuntu/Mint:

    $ sudo apt-get install build-essential libxmu-dev libxi-dev libgl-dev

    RedHat/CentOS/Fedora:

    $ sudo yum install libXmu-devel libXi-devel libGL-devel

    FreeBSD:

    # pkg install xorg lang/gcc git cmake gmake bash python perl5

    2. Build and Install

    $ make
    $ sudo make install
    $ make clean

    Available Targets

    • all: Build all targets
    • glew.lib: Build shared/static libraries (sub-targets: glew.lib.shared, glew.lib.static)
    • glew.bin: Build binaries
    • clean: Clean build artifacts
    • install: Install to system
    • uninstall: Remove installed files

    Build Variables

    • SYSTEM: e.g., linux-clang
    • GLEW_DEST: Installation destination (default /usr/local)
    • STRIP: Strip command
    $ make
    $ sudo make install
  6. Generate GLEW code from scratch

    master

    To include new extensions or customize code generation, you must use a Unix or Mac environment. The extension data is regenerated from the top-level source directory using:

    $ make extensions

    Alternatively, you can download pre-generated (unsupported) snapshots from SourceForge.

  7. Inspect OpenGL capabilities with glewinfo

    master
    The glewinfo command-line tool is used to inspect the capabilities of an OpenGL implementation and verify GLEW support. When reporting bugs, it is recommended to include the output of glewinfo (or the glewinfo.txt file generated by it).
  8. Identify GLEW Windows binary filenames

    master

    When building or distributing GLEW on Windows, the resulting filename depends on whether you are building a static library or a dynamic link library (DLL), and whether you are in a debug or release configuration.

    Use the following mapping to identify the correct file for your build type:

    • Static Library (GLEW_STATIC defined):
      • Debug: glew32sd.dll
      • Release: glew32s.dll
    • Dynamic Library (Default):
      • Debug: glew32d.dll
      • Release: glew32.dll