<p>I've been using OpenGL extensions on Windows the <a href="https://stackoverflow.com/questions/14413/using-opengl-extensions-on-windows">painful way</a>. Is GLEW the easier way to go? How do I get started with it?</p>

[{'answer_id': 17371, 'author': 'Ashwin Nanjappa', 'author_id': 1630, 'author_profile': 'https://Stackoverflow.com/users/1630', 'pm_score': 6, 'selected': True, 'text': '<p>Yes, the <strong>OpenGL Extension Wrangler Library</strong> (GLEW) is a painless way to use OpenGL extensions on Windows. Here\'s how to get started on it:</p>\n\n<p>Identify the OpenGL extension and the extension APIs you wish to use. OpenGL extensions are listed in the <a href="http://www.opengl.org/registry/" rel="noreferrer">OpenGL Extension Registry</a>.</p>\n\n<p>Check if your graphic card supports the extensions you wish to use. Download and install the latest drivers and SDKs for your graphics card.</p>\n\n<p>Recent versions of <a href="http://developer.nvidia.com/object/sdk_home.html" rel="noreferrer">NVIDIA OpenGL SDK</a> ship with GLEW. If you\'re using this, then you don\'t need to do some of the following steps.</p>\n\n<p>Download <a href="http://glew.sourceforge.net/" rel="noreferrer">GLEW</a> and unzip it.</p>\n\n<p>Add the GLEW <strong>bin</strong> path to your Windows <strong>PATH</strong> environment variable. Alternatively, you can also place the <strong>glew32.dll</strong> in a directory where Windows picks up its DLLs.</p>\n\n<p>Add the GLEW <strong>include</strong> path to your compiler\'s include directory list.</p>\n\n<p>Add the GLEW <strong>lib</strong> path to your compiler\'s library directory list.</p>\n\n<p>Instruct your compiler to use <strong>glew32.lib</strong> during linking. If you\'re using Visual C++ compilers then one way to do this is by adding the following line to your code:</p>\n\n<pre><code>#pragma comment(lib, "glew32.lib")\n</code></pre>\n\n<p>Add a <code>#include &lt;GL/glew.h&gt;</code> line to your code. Ensure that this is placed above the includes of other GL header files. (You may actually not need the GL header files includes if you include <code>glew.h</code>.)</p>\n\n<p>Initialize GLEW using <code>glewInit()</code> after you\'ve initialized GLUT or GL. If it fails, then something is wrong with your setup.</p>\n\n<pre><code>if (GLEW_OK != glewInit())\n{\n    // GLEW failed!\n    exit(1);\n}\n</code></pre>\n\n<p>Check if the extension(s) you wish to use are now available through GLEW. You do this by checking a boolean variable named <strong>GLEW<em>_your_extension_name</em></strong> which is exposed by GLEW.</p>\n\n<blockquote>\n  <p>Example:</p>\n</blockquote>\n\n<pre><code>if (!GLEW_EXT_framebuffer_object)\n{\n    exit(1);\n}\n</code></pre>\n\n<p>That\'s it! You can now use the OpenGL extension calls in your code just as if they existed naturally for Windows.</p>\n'}, {'answer_id': 17429, 'author': 'graham.reeds', 'author_id': 342, 'author_profile': 'https://Stackoverflow.com/users/342', 'pm_score': 3, 'selected': False, 'text': '<p>Personally I wouldn\'t use an exit command.</p>\n\n<p>I would throw an exception so you can clear any other initialisation up at the end of the function.</p>\n\n<p>ie:</p>\n\n<pre><code>try\n{\n    // init opengl/directx\n    // init directaudio\n    // init directinput\n\n    if (GLEW_OK != glewInit())\n    {\n        throw std::exception("glewInit failed");\n    }\n}\ncatch ( const std::exception&amp; ex )\n{\n    // message to screen using ex.what()\n    // clear up\n}\n</code></pre>\n\n<p>And I agree with OJ - if you want to write tutorials for others, then this is really the wrong place for it. There are already a load of good places for opengl tutorials. <a href="http://nehe.gamedev.net/" rel="noreferrer">Try this one for instance</a>.</p>\n'}, {'answer_id': 17922836, 'author': 'iMineLink', 'author_id': 2627697, 'author_profile': 'https://Stackoverflow.com/users/2627697', 'pm_score': 2, 'selected': False, 'text': '<p>I lost some time, but finally I managed to get GLEW working.\nI\'m using Windows7 (x64), Eclipse CDT and MinGW, and the way is that:</p>\n\n<p>Download MSYS (for MinGW) and rember to have MinGW installed correctly (PATH enviroinment variable set correctly):\n<a href="http://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.10/MSYS-1.0.10.exe/download?use_mirror=freefr&amp;download=" rel="nofollow">http://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.10/MSYS-1.0.10.exe/download?use_mirror=freefr&amp;download=</a></p>\n\n<p>Once MSYS installed, go to:\n<a href="http://glew.sourceforge.net/" rel="nofollow">http://glew.sourceforge.net/</a>\nand download the TGZ package, which is intended to use with UNIX systems</p>\n\n<p>Then open the package (you can use 7zip as well) and find the "Makefile".\nOpen it and with a text editor (Notepad should work fine) find the row which contains "GLEW_DEST" and replace it with something like "GLEW_DEST ?= C:/MinGW"</p>\n\n<p>Now you are ready to go, open MSYS (C:\\MinGW\\msys\\1.0\\msys.bat in my case) and in the shell opened, go to the folder where the "Makefile" is.</p>\n\n<p>Then write a simple: "make install" and the work is done (at least for me it worked)</p>\n\n<p>PS: I also copy-pasted glew-1.10.0-win32\\glew-1.10.0\\bin\\Release\\Win32 file\'s into my System32 folder, and in Eclipse CDT I added the library "glew32" in the linker option and added a <code>#include &lt;GL/glew.h&gt;</code> before <code>#include &lt;GL/glut.h&gt;</code></p>\n'}]
['https://Stackoverflow.com/questions/17370', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1630/']