NetBeans with C++ and OpenGL / Freeglut under Windows 7

℡╲_俬逩灬. 提交于 2019-12-06 14:18:02
lily

I had a difficult time getting glut working in Netbeans on Windows 7 until I found freeglut, I attributed this to the fact that glut is just very out of date and so are the tutorials I found.

Maybe this will help others looking for instructions on using freeglut in Netbeans. These instructions are like the ones in the link already provided, but help explain how to use it in Netbeans rather than from the command line. This tutorial expects that you've already gotten Netbeans and your compiler working together. IF you have not done so, I found the guide here very helpful: http://netbeans.org/community/releases/68/cpp-setup-instructions.html#mingw

  1. download and extract freeglut from http://www.transmissionzero.co.uk/computing/using-glut-with-mingw/ into an easy to reach folder. (I recommend C:/FrGlut)

  2. either add the bin folder (C:\FrGlut\bin) to your Windows PATH variable, or copy the freeglut.dll from your bin folder into C:\Windows\System32

  3. Open Netbeans and open or create your project

  4. go to: file->project properties

  5. Select your compiler, go to include directories, and add the path to your freeglut include folder (C:\FrGlut\include)

  6. under linker, select add libary, and navigate to the file C:\FrGlut\lib\libfreeglut.a

  7. select options and add the following individually:

    -dynamic -lfreeglut -lopengl32 -LC:\FrGlut\lib\libfreeglut.a

Netbeans should now be ready to use with your freeglut library.

To use the glut libary add the following include to your source:

#include <GL/glut.h>

Remember that freeglut.dll will need to be shared along with your executable in order for the program to run, as most users will not already have it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!