简体   繁体   中英

How can I set up freeGLUT and GLEW for use in Visual Studio 2013?

I want to be able to set up my computer and visual studio 2013 so I can use freGLUT and GLEW in my applications. I am new to OpenGL and have tried to follow the directions found here

http://openglbook.com/setting-up-opengl-glew-and-freeglut-in-visual-c/

I also went through the instructions here because the first set did not allow visual studios to see the files

http://www.cs.uregina.ca/Links/class-info/315/WWW/Lab1/GLUT/windows.html

I was able to get the test program from chapter 1 of the openglbook to run but in general I didn't fully understand a lot of the setup. Is there a simpler way to setup GLUT and GLEW for a newbie like me I would like to program with c++ and visual studios. Also did I need to do a lot of the property changes in the openglbook tutorial?

Update

For anyone else using the same book as me some of the source code can be found here

http://www.opengl-redbook.com/

book OpenGL Programming Guid The official guide to learning OpenGL version 4.3

http://www.amazon.com/OpenGL-Programming-Guide-Official-Learning/dp/0321773039/ref=cm_cr_pr_product_top

I have Visual Studio set with glut and glew and it's working fine. These are the steps I did:

Install Glut:

  • Download and unzip glut-3.7.6-bin.zip from here
  • Copy glut32.dll to C:\\Windows/System32
  • Copy glut32.lib to C:\\Program Files\\Microsoft Visual Studio 11.0\\VC\\lib
  • Copy glut.h to C:\\Program Files\\Microsoft Visual Studio 11.0\\VC\\include\\GL (You need to create the GL directory

Install Glew:

  • Download glext.h from here to C:\\Program Files\\Microsoft Visual Studio 11.0\\VC\\include\\GL
  • Download and unzip the file glew-1.10.0-win32.zip
  • Copy glew.dll from the bin directory to C:\\Windows\\System32
  • Copy glew32.lib and glew32s.lib from the lib directory to C:\\Program Files\\Microsoft Visual Studio 11.0\\VC\\lib
  • Copy glew.h, glxew.h and wglew.h from the include\\GL directory to C:\\Program Files\\Microsoft Visual Studio 11.0\\VC\\include\\GL

That's it! I hope this helps.

To setup GLUT for Visual Studio 2017:

  • Add glut32.dll to C:\\Windows\\System
  • Create empty project on C++
  • Set in Project > Properties > Configuration Properties > C/C++ > General > Additional Include Directories path to folder with glut32.lib and glut.h files
  • Set in Project > Properties > Configuration Properties > Linker > General > Additional Library Directories the same path
  • Set in Project > Properties > Configuration Properties > Linker > Input > Additional Dependencies string "glut32.lib"

Use Freeglut, the Free OpenGL Utility Toolkit alternative to GLUT.

FreeGlut Download and follow steps mentioned in README.cmake

For windows

How to build freeglut with CMake on Windows (MS Visual Studio)

  1. Download CMake ( http://www.cmake.org/cmake/resources/software.html ). Get one of the releases from the binary distribution section.
  2. Run the CMake installer, install wherever you like.
  3. Launch CMake via Start > Program Files > CMake 2.8 > CMake (GUI) (note that the shortcut put by the installer on your desktop does NOT point to the CMake GUI program!)
  4. In the "Where is the source code" box, type or browse to the root directory of your freeglut source (so that's /freeglut, not /freeglut/src).
  5. In the "Where to build the binaries" box, type or browse to any folder you like - this will be where the Visual Studio solution will be generated. This folder does not have to exist yet.
  6. Hit the Configure button near the bottom of the window.
  7. Pick your target compiler, make sure that its installed on your system of course!
  8. Answer Ok when asked if you want to create the build directory.
  9. Wait for the configure process to finish.
  10. The screen will now have some configuration options on it, for instance specifying whether you want to build static and/or shared libraries (see below for a complete list). When you've selected your options, click the Configure button again.
  11. The Generate button at the bottom will now be enabled. Click Generate.
  12. The build files will now be generated in the location you picked.

You can now navigate to the build directory you specified in step 5. Open the freeglut.sln file that was generated in your build directory, and compile as usual

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM