{"id":1135,"date":"2016-10-17T12:06:48","date_gmt":"2016-10-17T12:06:48","guid":{"rendered":"https:\/\/block.arch.ethz.ch\/blog\/?p=1135"},"modified":"2016-10-19T08:21:25","modified_gmt":"2016-10-19T08:21:25","slug":"pyopengl-glut-error","status":"publish","type":"post","link":"https:\/\/block.arch.ethz.ch\/blog\/2016\/10\/pyopengl-glut-error\/","title":{"rendered":"PyOpenGL GLUT error"},"content":{"rendered":"<p><a href=\"http:\/\/pyopengl.sourceforge.net\/\">PyOpenGL <\/a>is a very useful Python binding to <a href=\"https:\/\/www.opengl.org\/\">OpenGL<\/a>. It can be easily installed via pip from the command line:<\/p>\n<pre class=\"lang-py prettyprint prettyprinted\"><code><span class=\"pln\">pip install <\/span><span class=\"typ\">PyOpenGL<\/span> <span class=\"typ\">PyOpenGL_accelerate\r\n<\/span><\/code><\/pre>\n<p>However, the official (Windows) release <a href=\"http:\/\/stackoverflow.com\/questions\/26700719\/pyopengl-glutinit-nullfunctionerror\">does not install the\u00a0OpenGL Utility Toolkit<\/a>.<\/p>\n<p><!--more--><\/p>\n<p>This usually causes an error when importing:<\/p>\n<pre class=\"lang-py prettyprint prettyprinted\"><code><span class=\"pln\">from OpenGL.GL import *<\/span><\/code><\/pre>\n<p>of the type:<\/p>\n<pre class=\"lang-py prettyprint prettyprinted\"><code><span class=\"typ\">OpenGL<\/span><span class=\"pun\">.<\/span><span class=\"pln\">error<\/span><span class=\"pun\">.<\/span><span class=\"typ\">NullFunctionError<\/span><span class=\"pun\">:<\/span> <span class=\"typ\">Attempt<\/span><span class=\"pln\"> to call an undefined function glutInit<\/span><\/code><\/pre>\n<p>One quick solution is not to install as explained above, but to first download the\u00a0<a href=\"http:\/\/www.lfd.uci.edu\/~gohlke\/pythonlibs\/#pyopengl\">Unofficial Windows Binaries for Python Extension Packages<\/a>, and then pip install from the command line. The .whl file name will be different depending on your system, in my case:<\/p>\n<pre>pip install PyOpenGL-3.1.1-cp27-cp27m-win_amd64.whl\r\n<\/pre>\n<p>This version includes OpenGL.GLUT.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PyOpenGL is a very useful Python binding to OpenGL. It can be easily installed via pip from the command line: pip install PyOpenGL PyOpenGL_accelerate However, the official (Windows) release does not install the\u00a0OpenGL Utility Toolkit.<\/p>\n","protected":false},"author":24,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1135","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/posts\/1135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/comments?post=1135"}],"version-history":[{"count":7,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/posts\/1135\/revisions"}],"predecessor-version":[{"id":1205,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/posts\/1135\/revisions\/1205"}],"wp:attachment":[{"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/media?parent=1135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/categories?post=1135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/tags?post=1135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}