Javascript required
Skip to content Skip to sidebar Skip to footer

How to Use Opengl in Visual Studio 2017

Download Article

Download Article

Many programmers prefer OpenGL for graphics. If you are one of them, you are strongly advised by its producer, to use a window toolkit (such as freeGLUT) and an OpenGL loading libraries (such as GLEW). This guide will help you get over the first challenge of using OpenGL with freeGLUT and GLEW: Installing and setting them up, and creating your first project with OpenGL-freeGLUT-GLEW Template in Visual Studio 2019. or 2022 preview

This guide will assume your platform is Windows and your IDE is Visual Studio 2019 or 2022 preview. During Visual Studio installation, check the Desktop development with C++ workload box, click "Language pack" and check "English" box. It is addressing the beginner.

You learn three ways for create project with FreeGLUT and GLEW: a) targeting platform x32 (Parts 1, 2, 3, 4), b) targeting platform x64 (Parts 1, 5, 6, 7), c) project with source code compiled by CMake and Visual Studio (Parts 8, 9, 10, 11, 12)

  1. 1

    Highlight what you expect to do. Highlight step or sub-step or part of it and then do it. For example see picture above.

  2. 2

    Create folder GL. Open Windows's File Explorer > Navigate to disk (directory) C.

    • If folder GL already exists it's okay.
    • If doesn't exist, right click in empty area > select New > Folder > type GL > hit Enter .
  3. 3

    Download the application GLEW.

    • If you already have downloaded GLEW binaries and have them in folder GL, it's okay.
    • If you do not have them, right-click on following link and select Open Link in New Window http://glew.sourceforge.net. Below Downloads, besides Binaries, click "Windows 32-bit and 64-bit".
    • In thrown wizard check "Save" and click OK .
    • In downloading window click folder glew-2.1.0 > right click > select Copy.
    • (If folder glew-2.1.0-win32 is downloaded, double click it to get glew-2.1.0).
    • Navigate to C: > GL > right click > select Paste.
    • (Alternatively, open "Files Explorer" window > C: > GL. Go to downloading window > click downloaded folder and drag into C:\GL)
    • Click twice (no double) on name glew-2.1.0 and rename (by copy and paste if you prefer) to GLEWbin
  4. 4

    Download the freeglut 3.0.0 MSVC Package. In following link right click and select Open Link in New Window https://www.transmissionzero.co.uk/software/freeglut-devel/. In section freeglut 3.0.0 MSVC Package click Download freeglut 3.0.0 for MSVC.

    • In downloading window if you see stripes on folder's icon (compressed folder), double click it.
    • Click folder freeglut (uncompressed) > right click > select Copy.
    • Navigate to C: > GL. Right click > select Paste.
    • (Alternatively, open "Files Explorer" window > C: > GL. Go to downloading window > click downloaded folder and drag into C:\GL)
    • Click twice (no double) on its name and type (or copy and paste) GLUTbin
    • Now in folder GL you have folders: GLUTbin and GLEWbin.
  1. 1

    Create folder GLP. Navigate to disk (directory) C.

    • If it already exists it's okay. If it doesn't, go to disk C:, and create folder GLP.
  2. 2

    Create an empty project.

    • If Visual Studio is not open, open it, click Create a new project click Empty Project > Next .
      • In Configure your new project wizard for "Project name" type (or copy and paste) GLUTx32-GLEWx32
      • If "Location" text field is C:\GLP it's okay. If it's not copy C:\GLP and paste.
      • Check "Place solution and project in the same directory".
      • Click Create .
      • Wait till Visual Studio instance appears.
    • If Visual Studio is open, in main menu click File > New > Project… > the rest as above.
  3. 3

    Add your source file to the Project.

    • In the solution explorer window, right click the Source Files folder (the last one) > click Add > New Item….
    • In Add New Item - GLUTx32-GLEWx32 window, click C++ File (.cpp) (the first one) from the middle of the window. In the Name text box, type (or copy and paste) Main.cpp
    • Location should be C:\GLP\GLUTx32-GLEWx32\. If it's not, copy C:\GLP\GLUTx32-GLEWx32\ and paste.
    • Click the Add button. The file will open in the main text editor but leave the file blank for now.
  1. 1

    Configure "Properties Pages". In Solution Explorer, right click on the name of your project, that is GLUTx32-GLEWx32, and select Properties. Name in image is different, but it does'nt matter. .

    • Main menu. In GLUTx32-GLEWx32 Property Pages wizard main menu, in Configuration: select Active(Debug) > Platform: Win32 > click Configuration Manager .
      • "Configuration Manager" wizard
        • "Active solution platform:" select x86
        • "Platform" Win32 is automatically selected
        • Click Close .
    • Additional Include Directories. Open the C/C++ menu. Click General > Additional Include Directories > click the down arrow at the right of the field > click <Edit...>.
      • 1. Copy C:\GL\GLUTbin\include > in Additional Include Directories wizard, click first icon > paste.
      • 2. Copy C:\GL\GLEWbin\include > click again first icon > paste.
      • In Additional Include Directories wizard click OK .
    • Additional Library Directories. Open the Linker drop-down menu, and click General > click Additional Library Directories entry > down arrow at the right of the field > <Edit...>.
      • 1. Copy C:\GL\GLUTbin\lib > in Additional Library Directories wizard click first icon > paste.
      • 2. Copy C:\GL\GLEWbin\lib\Release\Win32 > click first icon > paste.
      • In Additional Library Directories wizard click OK .
    • Additional Dependencies. In the Linker drop-down menu, click Input > click the Additional Dependencies entry > the down arrow at the right of the field > click <Edit...>.
      • Copy freeglut.lib; glew32.lib; opengl32.lib and paste on the top-most text box of the Additional Dependencies wizard.
      • Click OK in the Additional Dependencies wizard.
    • System. In the Linker drop-down menu, click System > SubSystem. Click the down arrow and select Console(/SUBSYSTEM:CONSOLE) from the drop-down menu.
    • Click Apply , then OK on the GLUTbin-GLEWbin-0 Property Pages wizard.
  2. 2

    Copy dll files and paste in project-folder. Copy C:\GLP\GLUTx32-GLEWx32 and paste in Windows "File Explorer" Address Bar > hit Enter > click "File" in the upper left corner of the window > click "Open in new window". Second F.E. window is thrown.

    • Copy C:\GL\GLUTbin\bin and paste in second F.E.'s Address Bar > hit Enter > click file "freeglut.dll" > right click > select "Copy".
    • In first F.E., in empty area, right click > select Paste.
    • Copy C:\GL\GLEWbin\bin\Release\Win32 and paste in second F.E. Address Bar > hit Enter > click file glew32.dll > right click > select Copy.
    • In first F.E., in empty area, right click > select Paste.
    • Now in GLUTx32-GLEWx32 project folder you have dll files "freeglut.dll" and glew32.dll among Main.cpp and 4 other files created by Visual Studio. If 4 files and Main.cpp are not created, you did not add file Main.cpp. Go to Part 2, step 3, and add it now.
  3. 3

    Test your project. Right click on following link and select Open Link in New Window badprog. Scroll down the page and find section Testing the setup (see image above). Copy code and paste in Main.cpp code area > hit Ctrl + F5 . You should see two windows: one black (the console) and other with white square in black background. If you do not see that, do bellow step.

  4. 4

    Correct any errors. In "Error List" if you see error about

    • file with extension .h go to Part 3, step 1, Additional Include Directories and follow instructions.
    • file with extension .lib go to Part 3, step 1, Additional Library Directories, and follow instructions. Also to step 1, Additional Library Directories.
    • "entry point must be defined" go to step 1, System and follow instructions.
    • file .dll go to step 2 Copy dll files and paste into project-folder, and follow instructions.
    • For other errors, if you cannot correct them, close Visual Studio > delete project folder GLUTx32-GLEWx32 which lives in C:\GLP > open Visual Studio > repeat set up from part Part 2. Good job.
  1. 1

    Create template. Go to Visual Studio main menu and, while "GLUTx32-GLEWx32" is open, click Project > Export Template.... On Export template Wizard check Project Template, if it's not checked. Click Next > . On Select Template Options, in Template name text box type (or copy and paste) GLUTx32-GLEWx32. Click Finish .

    • Template has been created. Close thrown window with template's path.
  2. 2

    Create project. In Visual Studio GUI, click File > New > Project....

    • In Create a new project wizard, in templates list select (if necessary scroll down the list) "GLUTx32-GLEWx32" > click Next .
    • In Configure your new project wizard, in "'Project name"' text field type (or copy and paste) GLUT-GLEW-1
    • Copy C:\GLP, and paste in Location text field.
    • Be sure Place solution and project in the same directory is checked.
    • Click Create .
  3. 3

    Copy dll files and paste in project-folder. Copy C:\GLP\GLUTx32-GLEWx32 and paste in Windows "File Explorer" Address Bar > hit Enter > click "File" in the upper left corner of the window > click "Open in new window". Second F.E. window is thrown.

    • Copy C:\GL\GLUTbin\bin and paste in second F.E.'s Address Bar > hit Enter > click file "freeglut.dll" > right click > select "Copy".
    • In first F.F., in empty area, right click > select Paste.
    • Copy C:\GL\GLEWbin\bin\Release\Win32 and paste in second F.E. Address Bar > hit Enter > click file glew32.dll > right click > select Copy.
    • In first F.F., in empty area, right click > select Paste.
    • Now in GLUTx32-GLEWx32 project folder you have dll files "freeglut.dll" and glew32.dll among Main.cpp and 4 other files created by Visual Studio.
  4. 4

    Test your project and correct errors as above, Part 3, steps 7 and 8. Good job!

  1. 1

    Go to Visual Studio main menu. Click File > New > Project… > in Create a new project wizard, click Empty Project > Next .

    • Copy GLUTx64-GLEWx64 and paste in Project name text field.
    • Copy C:\GLP\ and paste in Location text field.
    • Check "Place solution and project in the same directory".
    • Click Create .
    • Wait till Visual Studio instance appears.
  2. 2

    Add source file to project folder.

    • In the Solution Explorer window, right click the Source Files folder (the last one) > click Add > New Item….
    • In the Add New Item - GLUTx64-GLEWx64 window, click C++ File (.cpp) (the first one) from the middle of the window. In the Name text box, type Main.cpp.
    • The Location is C:\GLP\GLUTx64-GLEWx64\. If it's not copy C:\GLP\GLUTx64-GLEWx64\ and paste.
    • Click the Add button. The file will open in the main text editor but leave the file blank for now.
  1. 1

    Configure "Properties Pages". In Solution Explorer, right click on the name of your project, that is GLUTx64-GLEWx64, and select Properties. Name in image is different, but it does'nt matter. .

    • Main menu. In GLUTx64-GLEWx64 Property Pages wizard main menu, in Configuration: select Active(Debug) > Platform: x64 > click Configuration Manager .
      • In "Configuration Manager" wizard
        • "Active solution platform:" select x64
        • "Platform" x64 is automatically selected
        • Click Close .
    • Additional Include Directories. Open the C/C++ menu. Click General > Additional Include Directories > click the down arrow at the right of the field > click <Edit...>.
      • 1. Copy C:\GL\GLUTbin\include > in Additional Include Directories wizard, click first icon > paste.
      • 2. Copy C:\GL\GLEWbin\include > click again first icon > paste.
      • In Additional Include Directories wizard click OK .
    • Additional Library Directories. Open the Linker drop-down menu, and click General > click Additional Library Directories entry > down arrow at the right of the field > <Edit...>.
      • Copy C:\GL\GLUTbin\lib\x64 > in Additional Library Directories wizard click first icon > paste.
      • Copy C:\GL\GLEWbin\lib\Release\x64 > click first icon > paste.
      • In Additional Library Directories wizard click OK .
    • Additional Dependencies. In the Linker drop-down menu, click Input > click the Additional Dependencies entry > the down arrow at the right of the field > click <Edit...>.
      • Copy freeglut.lib; glew32.lib; opengl32.lib and paste on the top-most text box of the Additional Dependencies wizard.
      • Click OK in the Additional Dependencies wizard.
    • System. In the Linker drop-down menu, click System > SubSystem. Click the down arrow and select Console(/SUBSYSTEM:CONSOLE) from the drop-down menu.
    • Click Apply , then OK on the GLUTx64-GLEWx64 Property Pages wizard.
  2. 2

    Copy dll files and paste in project-folder. Copy C:\GLP\GLUTx64-GLEWx64 and paste in Windows "File Explorer" Address Bar > hit Enter > click "File" in the upper left corner of the window > click "Open in new window". Second F.E. window is thrown.

    • Copy C:\GL\GLUTbin\bin\x64 and paste in second F.E.'s Address Bar > hit Enter > click file "freeglut.dll" > right click > select "Copy".
    • In first F.E., in empty area, right click > select Paste.
    • Copy C:\GL\GLEWbin\bin\Release\x64 and paste in second F.E. Address Bar > hit Enter > click file glew32.dll > right click > select Copy.
    • In first F.E., in empty area, right click > select Paste.
    • Now in GLUTx64-GLEWx64 project folder you have dll files "freeglut.dll" and glew32.dll among Main.cpp and 4 other files created by Visual Studio. If 4 files and Main.cpp are not created, you did not add file Main.cpp. Go to Part 5, step 2, and add it now.
  3. 3

    Test your project. Right click on following link and select Open Link in New Window badprog. Scroll down the page and find section Testing the setup (see image above). Copy code and paste in Main.cpp code area > hit Ctrl + F5 . You should see two windows: one black (the console) and other with white square in black background. If you do not see that, do bellow step.

  4. 4

    Correct any errors. In "Error List" if you see error about

    • file with extension .h go to step 1, '"Additional Include Directories and follow instructions.
    • file with extension .lib go to step 1, Additional Library Directories, and follow instructions.
    • "entry point must be defined" go to step 1, 'System and follow instructions.
    • file .dll go to step 2 "Copy dll files and paste into project-folder, and follow instructions.
    • For other errors, if you cannot correct them, close Visual Studio > delete project folder GLUTx64-GLEWx64 which lives in C:\GLP > open Visual Studio > repeat set up from part Part 5. Good job.
  5. 5

    Tip: Even if in Property Pages main settings it is Platform: x64 , click Configuration manager... and in Active solution platform: select x64.

  1. 1

    Create template. Go to Visual Studio main menu and, while GLUTx64-GLEWx64 is open, click Project > Export Template.... On Export template Wizard check Project Template, if it's not checked. Click Next > . On Select Template Options, in Template name text box type (or copy and paste) GLUTx64-GLEWx64

    • Click Finish .
    • Template has been created. Close thrown window with template's path.
  2. 2

    Create project.

    • Click File > New > Project....
    • In Create a new project wizard, in templates list, select (if necessary scroll down the list) GLUTx64-GLEWx64 > click Next .
    • In Configure your new project wizard, in "'Project name"' text field type (or copy and paste) GLUTx64-GLEWx64-1
    • Copy C:\GLP, and paste in Location text field.
    • Be sure Place solution and project in the same directory is checked.
    • Click Create .
    • In Visual Studio main menu switch x86 to x64 .
    • In the Solution Explorer, double click Source Files > double click ++Main.cpp. Its code appears in the code area. Run it. If code does not appear, right click ++Main.cpp > click Exclude From Project. Now create new Main.cpp.
  3. 3

    Copy dll files and paste in project-folder. Copy C:\GLP\GLUTx64-GLEWx64-1 and paste in Windows "File Explorer" Address Bar > hit Enter > click "File" in the upper left corner of the window > click "Open in new window". Second F.E. window is thrown.

    • Copy C:\GL\GLUTbin\bin\x64 and paste in second F.E.'s Address Bar > hit Enter > click file "freeglut.dll" > right click > select "Copy".
    • In first F.E., in empty area, right click > select Paste.
    • Copy C:\GL\GLEWbin\bin\Release\x64 and paste in second F.E. Address Bar > hit Enter > click file glew32.dll > right click > select Copy.
    • In first F.E., in empty area, right click > select Paste.
    • Now in GLUTx64-GLEWx64-1 project folder you have dll files "freeglut.dll" and glew32.dll among Main.cpp and 4 other files created by Visual Studio.
  4. 4

    Test your project and correct errors. As above part 6, steps 3, 4. Good job!

    • Tip: In every project you create with it, select x64 (next to Debug) in Visual Studio's GUI, and add dll files as in present Part.
  1. 1

    Create folder GL. Open Windows's File Explorer > Navigate to disk (directory) C. If folder GL already exists it's okay.

    • If doesn't exist, right click in empty area > select New > Folder > type GL > hit Enter .
  2. 2

    Download CMake. Right-click on following address and select Open Link in New Window https://cmake.org/download/. Scroll down the page and find "Latest Release (3.21.3)", (or newer). In second "Platform" list, find "Windows x64 ZIP" and click the beside entry cmake-3.21.3-windows-x86_64.zip > in opening wizard select Save file.

  3. 3

    Copy and unzip the zip folder.

    • If downloaded folder's icon contains vertical line with stripes (zipped folder), click folder > right click > in drop-down menu select Extract all.
      • When unzipping (extracting files) is finished, click unzip folder cmake-3.21.2-windows-x86_64.zip (or newer) > right click > Copy.
    • If downloaded folder doesn't contain line with stripes (unzipped folder) click it > right click > Copy.
    • Go to drive (directory) C: > GL > right click > Paste.
    • When copying is finished open folder and click folder bin > inside you should see CMake's logo next to file name cmake-gui > double click this file. If wizard "Windows protect your PC" appears, click More information > Run anyway. Now on your screen you have CMake GUI.
    • Each time you need CMake, navigate to C:\ > GL > click unzip folder cmake-3.21.3-windows-x86_64.zip, (or newer) > right click > Copy. > bin > double click file cmake-gui (the one with CMake's logo).
  1. 1

    Download FreeGLUT source. Right-click on following address and select Open Link in New Window https://sourceforge.net/projects/freeglut/. Click Download .

    • In downloading window (directory "Downloads") click folder "freeglut-3.2.1.tar.gz" > right click > select "7-Zip" (if you don't have it, download it) > "Extract here".
    • Click folder "freeglut-3.2.1.tar" > right click > select "7-Zip" > "Extract here".
    • Alternatively, if you have WinRAP, click folder "freeglut-3.2.1.tar" > right click > select "Extract here". Click on folder "freeglut-3.2.1.tar" > select "Extract here".
    • Or, click "WinZip". If you don't have it, download WinZip evaluation free trial for 30 days and follow instructions.
    • Click on decompressed folder "freeglut-3.2.1" > right click > "Copy" > go to C:\ > GL > right click > "Paste".
    • Click on folder "freeglut-3.2.1" > right click > click "Rename" > type (or copy and paste): GLUTsrc > hit Enter .
  2. 2

    Download GLEW source. Right-click on following address and select Open Link in New Window http://glew.sourceforge.net/. Beside Source click ZIP.

    • In downloaded window click folder glew-2.1.0 (or latest) > right click > Copy.
    • Navigate to C:\ > GL. Right click > Paste. Rename folder to GLEWsrc > hit Enter . Now in folder GL you have folders GLUTsrc and GLEWsrc.
  3. 3

    Build FreeGLUT by CMake and Visual Studio.

    • Go to CMake GUI.
    • In first text field type C:/GL/GLUTsrc
    • In second text field type C:/GL/GLUTsrc/build
    • Configure and generate. In CMake GUI, click Configure > in wizard Create Directory click Yes > select Visual Studio 16 2019, or Visual Studio 17 2022 > click Finish .
      • When, in CMake GUI, you read: "Configuring done", click Generate . You should read: "Generating done".
    • Build your solution.
      • Navigate to C: > GL > GLUTsrc > build. Double click "freeglut.sln", or "freeglut", or "ALL_BUILD.vcxproj". An instance of Visual Studio appears. Wait until in main menu, Build entry appears. Click Build > Build Solution (the first option).
      • Wait till you read the last line in "Output" window: ========== Build: 28 succeeded, 0 failed, 0 up-to-date, 1 skipped" ==========
        • Number of "succeeded" changes in freeglut versions.
    • Navigate to C:\GL\GLUTsrc\build\lib\Debug. Inside you should see file freeglutd.lib below other files.
  4. 4

    Build GLEW by CMake and Visual Studio. Follow above step but

    • In first text field type C:/GL/GLEWsrc/build/cmake
    • In second type C:/GL/GLEWsrc/build
    • Navigate to C: > GL > GLEWsrc > build. Double click "glew.sln", or "glew", or "ALL_BUILD.vcxproj". An instance of Visual Studio appears. Wait until in main menu Build entry appears. Click Build > Build Solution (the first option).
      • Wait till you read the last line in "Output" window: ========== Build: 6 succeeded, 0 failed, 0 up-to-date, 2 skipped" ==========
        • Number of "succeeded" changes in glew versions.
    • Navigate to C: > GL > GLEWsrc > build > lib > Debug. Inside you should see file glew32d.lib among other files.
  1. 1

    Create project with built FreeGLUT and built GLEW. In directory (disk) C: create folder GLP, if doen't exist.

    • In Visual Studio main menu click File > New > Project… > in wizard Create a new project click Empty Project > Next .
      • In Configure your new project wizard for "Project name" type: GLUTsrc-GLEWsrc
      • In "Location" text field delete everything and type C:\GLP\
      • Check "Place solution and project in the same directory"
      • Click Create .
      • Wait till Visual Studio instance appears.
  2. 2

    Add your source file to the Project.

    • In Visual Studio GUI, "Solution Explorer" wizard, right click the Source Files (the last one) > click Add > New Item….
    • In the Add New Item - GLUTsrc-GLEWsrc wizard, click C++ File (.cpp) (the first one) from the middle of the window. In the Name text box, type Main.cpp.
    • Location should be C:\GLP\GLUTsrc-GLEWsrc\. If it's not, copy C:\GLP\GLUTsrc-GLEWsrc\ and paste.
    • Click the Add button. The file will open in the main text editor but leave the file blank for now.
  1. 1

    Configure "Properties pages". In Solution Explorer wizard, right click Project's name that is GLUTsrc-GLEWsrc > select Properties. Name in image is different, but it does'nt matter. .

    • Main menu. In Configuration: select Active(Debug) In Platform entry select x64 > click Configuration Manager... .
      • In Active solution platform: select x64.
      • In Platform entry, x64 is automatically selected.
      • Click Close .
    • Additional Include Directories. Open C/C++ > General > In beside menu select the first one, Additional Include Directories > click the down arrow at the end of the field > click Edit...
      • Copy C:\GL\GLUTsrc\include > click first icon in Additional Include Directories wizard > paste.
      • Copy C:\GL\GLEWsrc\include > click first icon > paste.
      • Click OK in Additional Include Directories wizard.
    • Additional Library Directories. Double click Linker > click General > Additional Library Directories > click the down arrow at the end of the field > click Edit....
      • Copy C:\GL\GLUTsrc\build\lib\Debug > click first icon > paste.
      • Copy C:\GL\GLEWsrc\build\lib\Debug > click first icon > paste.
      • In Additional Library Directories wizard, click OK .
    • Additional Dependencies. In Linker drop-down menu select Input > in beside menu select the first one, Additional Dependencies > click the down arrow at the end of the field > Edit...
      • Copy opengl32.lib; freeglutd.lib; glew32d.lib and paste in Additional Dependencies wizard's upper-most text box
      • In Additional Dependencies wizard, click OK .
    • System. In Linker drop-down menu select System > in beside menu select the first one, SubSystem > click the down arrow at the end of the field > select Console (/SUBSYSTEM:CONSOLE). Click Apply and OK .
  2. 2

    Copy dll files and paste in project-folder. Copy C:\GLP\GLUTsrc-GLEWsrc and paste in Windows "File Explorer" Address Bar > hit Enter > click "File" in the upper left corner of the window > click "Open in new window". Second F.E. window is thrown.

    • Copy C:\GL\GLUTsrc\build\bin\Debug and paste in second F.E.'s Address Bar > hit Enter > click file "freeglut.dll" > right click > select "Copy".
    • In first F.E., in empty area, right click > select Paste.
    • Copy C:\GL\GLEWsrc\build\bin\Debug and paste in second F.E. Address Bar > hit Enter > click file glew32.dll > right click > select Copy.
    • In first F.E., in empty area, right click > select Paste.
    • Now in GLUTsrc-GLEWsrc project folder you have dll files "freeglut.dll" and glew32.dll among Main.cpp and 4 other files created by Visual Studio. If 4 files and Main.cpp are not created, you did not add file Main.cpp. Go to Part 10, step 2, and add it now.
  3. 3

    Test your project and correct errors if any. As above Part 3, steps 3 and 4.

  1. 1

    Create template. Go to Visual Studio main menu and, while GLUTsrc-GLEWsrc is open, click Project > Export Template.... On Export template Wizard check Project Template, if it's not checked. Click Next > . On Select Template Options, in Template name text box type (or copy and paste) GLUTsrc-GLEWsrc

    • Click Finish .
    • Template has been created. Close thrown window with template's path.
  2. 2

    Create project.

    • Click File > New > Project....
    • In Create a new project wizard, in templates list, select (if necessary scroll down the list) GLUTsrc-GLEWsrc > click Next .
    • In Configure your new project wizard, in "'Project name"' text field type (or copy and paste) GLUTsrc-GLEWsrc-1
    • Copy C:\GLP, and paste in Location text field.
    • Be sure Place solution and project in the same directory is checked.
    • Click Create .
    • In Visual Studio main menu switch x86 to x64 .
    • In the Solution Explorer, double click Source Files > double click ++Main.cpp. Its code appears in the code area. Run it. If code does not appear, right click ++Main.cpp > click Exclude From Project. Now create new Main.cpp.
  3. 3

    Copy dll files and paste in project-folder. Copy C:\GLP\GLUTsrc-GLEWsrc-1 and paste in Windows "File Explorer" Address Bar > hit Enter > click "File" in the upper left corner of the window > click "Open in new window". Second F.E. window is thrown.

    • Copy C:\GL\GLUTsrc\build\bin\Debug and paste in second F.E.'s Address Bar > hit Enter > click file "freeglut.dll" > right click > select "Copy".
    • In first F.E., in empty area, right click > select Paste.
    • Copy C:\GL\GLEWsrc\build\bin\Debug and paste in second F.E. Address Bar > hit Enter > click file glew32.dll > right click > select Copy.
    • In first F.E., in empty area, right click > select Paste.
    • Now in GLUTsrc-GLEWsrc-1 project folder you have dll files "freeglut.dll" and glew32.dll among Main.cpp and 4 other files created by Visual Studio.
  4. 4

    Test your project and correct errors. As above part 6, steps 3, 4. Good job!

    • Tip: In every project you create with it, select x64 (next to Debug) in Visual Studio's GUI, and add dll files as in present Part.
  1. 1

    In this tutorial you learn 3 was to set up FreeGLUT and GLEW in Project with Visual Studio.

    • Set up binaries x86 (32 bits). It's the easiest. You should start learning set up from here.
    • Set up binaries x64 (64 bits). It targets x64 platform. Choose it only when you have specific reason for doing so.

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit


Thanks for submitting a tip for review!

About This Article

Thanks to all authors for creating a page that has been read 25,993 times.

Is this article up to date?

How to Use Opengl in Visual Studio 2017

Source: https://www.wikihow.com/Set-Up-an-OpenGL-FreeGLUT-GLEW-Template-Project-in-Visual-Studio