The Python environment is built with OpenGL

Source: Internet
Author: User

The following is my Python OpenGl environment setup process:

Win7 64-bit operating system, python3.5.3, no other relevant.

Direct cmd or PowerShell enter the following command:

Install  Pyopengl pyopengl_accelerate

Installation failed, prompting you to install Microsoft Visual C + + 14.0, let me use Microsoft Visual C + + build tools. and the download link Http://landinghub.visualstudio.com/visual-cpp-build-tools is given later, and the link is downloaded to get the file Visualcppbuildtools_ Full.exe, to install ...

Failed, prompting requires more than. NET framework4.5.1

At first I downloaded the. NET Framework 4.5 found not yet installed, so re-search, and finally in https://www.microsoft.com/zh-CN/download/details.aspx?id= 48130 found 4.6 version, downloaded file Ndp46-kb3045560-web.exe installed.

Finally, you can have Microsoft Visual C + + build tools (Visualcppbuildtools_full.exe).

After a long wait for VC also fix, restart after the execution of the command:

Install  Pyopengl pyopengl_accelerate

One-time success, excitement on the Internet to find a section of the test code, and a slight adjustment ( Glutcreatewindow (b "First"), the original is Glutcreatewindow ("first"), the operation will be error:Python Glutcreatewindow error ' wrong type ', see https://codeyarns.com/2012/04/27/pyopengl-glut-ctypes-error/for details )

 fromOpengl.glImport* fromOpengl.gluImport* fromOpengl.glutImport*defDrawfunc ():#Clear the previous screenglclear (gl_color_buffer_bit) Glrotatef (0.1, 5, 5, 0)#(angle, x, Y, z)Glutwireteapot (0.5)    #Refresh DisplayGlflush ()#initializing OpenGL with glutGlutinit ()#display mode: Glut_single direct display without buffering | Glut_rgba with RGB (a non-alpha)Glutinitdisplaymode (Glut_single |Glut_rgba)#window position and size-generatedglutinitwindowposition (0,0) glutinitwindowsize (400,400) Glutcreatewindow (b" First")#call function to draw an imageGlutdisplayfunc (Drawfunc) glutidlefunc (drawfunc)#Main LoopGlutmainloop ()

Run, the results prompt OpenGL.error.NullFunctionError:Attempt to the undefined function glutinit, check for bool (GLUTINIT) before Cal Ling Originally I did not build glut, and began a long search distance, finally found in http://download.csdn.net/detail/knownall/6799947 need (in fact, need glut.h, Glut64.dll, Glut64.lib three files, 32-bit similarly).

After downloading the extract, place the folder Glut.h under C:\Program Files (x86) \microsoft Visual Studio 14.0\vc\include\;

Place the. \release\glut64.lib under C:\Program Files (x86) \microsoft Visual Studio 14.0\vc\lib\;

Put the. \release\glut64.dll under C:\Windows\System32.

Run again, and finally done, you can see a rotating teapot.

The Python environment is built with OpenGL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.