Setting up OpenGL

The last assignment of CMU CG course is  a self-selected project (detail).

What I chose is Option F, SPH Fluid Simulation, cooperated with Sarvesh Subramanian. I implemented the SPH model, while he took charge of the Marching Cube algorithm and OpenGL part.

This post includes a tutorial of how to setup OpenGL project on Windows by Visual Studio 2015.

  1. Download the library from here and extract it. you get:042616_cgfinal1_01
  2. Create an empty project in Visual Studio. (What I used was VS 2015)
  3. Press ctrl+shift+A to add a new item, choose Visual C++ > C++ file, name it “main.cpp”;
  4. In Solution Explorer, right click the project (NOT the solution), choose properties.042616_cgfinal1_02
  5. On the top left besides Configuration, click on the drop down menu and choose All Configurations. ( For some reason I cannot switch the language to English or it will cause error. but the location of the menu and the option might be the same )042616_cgfinal1_03
  6. On the left menu, choose Configuration Properties > C/C++ > General > Additional Include Directions. Choose it and click on <eidt..>042616_cgfinal1_04
  7. In the pop-up window, click on the blank place, click the “” button. Choose (your extract location)/freeglut/include from the folder you just extracted. Click on the following line, click the “” button, and again, choose (your extract location)/glew-1.11.0/include. Once you done, click OK.042616_cgfinal1_05042616_cgfinal1_06
  8. Back to the Property Page, on the left choose choose Configuration Properties > Linker > Input> Additional Dependencies. Choose it and click on <edit..>042616_cgfinal1_07
  9. In the pop-up window, input “freeglut.lib” and “glew32.lib” as 2 lines. Then click “OK“.042616_cgfinal1_08
  10. Back to the Property Page, on the left choose choose Configuration Properties > Linker > General> Additional Library Directions. Choose it and click on <edit..>042616_cgfinal1_09
  11. As step 7, add (your extract location)/freeglut/lib and (your extract location)/glew-1.11.0/lib
  12. Back to the Property Page, click on “Apply” and “OK“.
  13. In Solution Explorer, right click the project, choose Open Folder in File Explorer.042616_cgfinal1_10
  14. Copy freeglut.dll and glew32.dll from the file you extracted to the file.042616_cgfinal1_11

Now you should be able to code your OpenGL project. If you want to test whether the system is working, you can copy code from (your extract location)/Base Code.txt to main.cpp and run it. The result should be:042616_cgfinal1_12

references:

How to Set up OpenGL and GLUT in Visual Studio (C++)

 

Leave a Reply