views
Configuring Visual Studio
Emphasize the actions you plan to take. Highlight a step, a substep, or a section of it, then carry it out. Take a look at the image above.
Download Visual Studio 2022 Community. While downloading, check the box labeled "Desktop development with C++ workload." Scroll down the page if needed (see the image below. Developpement desktop 1.png Select "Language pack" and tick the "English" option. Click "General" in the "Development settings" menu of the "Personalize your Visual Studio experience" wizard during installation. > click "Visual C++" > click Start Visual Studio.
Downloading GLFWx32 and GLAD
Make the GL and GLP folders. Launch the File Explorer in Windows > Open the directory (disk) C. It's okay if the folders GL and GLP exist. If not, perform a right-click in an empty space > choose "New" > "Folder" > type GL > press ↵ Enter. Create the GLP folder in the same manner. Make a folder named GLAD inside the "GL" folder.
Download GLFW x32. Choose Open Link in New Window by right-clicking on the following address: https://www.glfw.org/download.html. Click 32-bit Windows binaries. You receive the most recent version, glfw-3.4.bin.WIN32 (or latest). Open folder C:\GL. After folder "glfw-3.4.bin.WIN32" has been downloaded and unzipped in the new File Explorer window, click it > click it again and drag into C:\GL. Close the new "File Explorer" window > close the GLFW window. Once the folder has completed copying, and pasting, copy GLFWx32 > click folder > right click > click "Rename" > Paste > hit ↵ Enter. Now in "GL" folder you have folders "GLAD" (empty) and "GLFWx32".
Download GLAD. Right click on following address and select Open Link in New Window https://glad.dav1d.de/. In Language leave C/C++. Below API, in gl entry, select the latest version (today is 4.6). In Specification leave OpenGL. In Profile select Core. Ignore the Extensions. Make sure in Options list "Generate a loader" option is ticked. Click GENERATE. In "Glad" window (see picture above), click "glad.zip". In downloading new File Explorer window you have two unzip folders: include and src. Open folder C:\GL\GLAD. Click folder include > click it again and drag into folder GLAD, at C:\GL\GLAD. Click folder src > click it again and drag into folder GLAD, at C:\GL\GLAD. Now in folder GLAD you have two unzip folders: include and src. Go back to GL folder. Close GLAD window > close downloading new File Explorer window.
Creating Project GLFWx32-GLAD-0
Create empty project. If it's the first time you open Visual Studio. Click Create a new project. In Create a new project wizard, find Empty Project Start from scratch with C++ for Windows. Provides no starting files. (see image above, if necessary type Empty Project in search box above the list and hit ↵ Enter) > click it > click Next. In Configure your new project wizard for "Project name" type (or copy and paste) GLFWx32-GLAD-0 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. If it's not the first time. In main menu click File > New > Project… > the rest as above..
Add your Source file to the project. In "Solution Explorer" window right click the "Source Files" folder (the last one) > click "Add > "New Item…" In the "Add New Item" wizard instead of "FileName" type Main > hit ↵ Enter. The source file Main.cpp will open in the main text editor but leave the file blank for now.
Add file glad.c. Go to Visual Studio > Solution Explorer > right click Source Files > click Add > Existing Item ... . Copy C:\GL\GLAD\src and paste in "Add Existing Item - GLFWx32-GLAD-0" wizard Address Bar > hit Enter > click glad.c. "File name" should be glad.c. Click Add.
Testing Project GLFWx32-GLAD-0 and Correcting errors
Test your project. Right click on following address and select Open Link in New Window https://learnopengl.com/code_viewer_gh.php?code=src/1.getting_started/2.1.hello_triangle/hello_triangle.cpp. Copy the code. Go to Visual Studio and paste in Main.cpp code area > in main menu select x86 > hit Ctr+F5 or in Visual Studio's main menu click the green triangle with phrase "Local Windows Debugger", and wait... Two windows should appear: One black and other with name "LearnOpenGL" and inside an orange triangle. If only the black window (the console) appears with message: "Failed to create GLFW window", set up is okay, function glfwCreateWindow did not work.
Correct any errors. Files are missing. Copy GLFWx32-GLAD-0 and paste in File Explorer Address Bar. You should see file you added Main.cpp, and 4 other files added by Visual Studio. If they are missing you missed add file Main.cpp. Go to Part 3, step 2, and add it now. In "Error List" if you see error about file with extension .h Check whether folders GLFWx32 and GLAD exist in C:\GL. If they exist, go to previous Part, step 1, sub step 2. Additional Include Directories and follow instructions. file with extension .lib go to previous Part, step 1, sub step 3. Additional Library Directories, and follow instructions. Also to step 1, sub step 4. Additional Dependencies. file glad.c go to Part 3, step 3, and follow instructions. For other errors, if you cannot correct them, close Visual Studio > delete project folder GLFWx32-GLAD-0 which lives in C:\GLP > open Visual Studio > repeat set up from Part 3. Good job.
Creating a Project with GLFWx32-GLAD-0 Template
Create Template. Go to Visual Studio main menu and, while GLFWx32-GLAD-0 is open, click Project > Export Template... > in Choose Template Type, confirm "Project template" is selected > click Next >. On Select Template Options, Template name: should be GLFWx32-GLAD-0. Click Finish. The Template has been created. Close the thrown window with template's path. Set Up SDL with Visual Studio 2017 Step 16 Version 2.jpg
Create Project. In Visual Studio main menu, click File > New > Project.... In Create a new project wizard in the list of templates select GLFWx32-GLAD-0, (if necessary type it in search box above the list and hit ↵ Enter) > click Next. In Configure your new project wizard, "Project name" should be GLFWx32-GLAD-01. "Location" should be C:\GLP. Make sure "Place solution and project in the same directory" is checked. Click Create, and wait till project be created. In Visual Studio main menu, select x86. Hit Ctr+F5 or in Visual Studio's main menu click the green triangle with phrase "Local Windows Debugger". Good job.
Tips. When you create project with template, remember, in Visual Studio main menu, select x86.
Downloading GLFW x64 and GLAD
Create folders GL and GLP. Open Windows's File Explorer > Navigate to disk (directory) C. If folders GL and GLP exist it's okay. If they do not, right click in empty area > select New > Folder > type GL > hit ↵ Enter. By same way create folder GLP.
Download GLFW x64. Right click on following address and select Open Link in New Window https://www.glfw.org/download.html Click 64-bit Windows binaries. You get "glfw-3.4.bin.WIN64" or latest version. Open folder C:\GL, if it's not already open. After folder "glfw-3.4.bin.WIN64" has been downloaded and unzipped in the new File Explorer window, click it > click it again and drag into C:\GL. Once the folder has completed copying and pasting, copy GLFWx64 > click folder > right click > click "Rename" > Paste > hit ↵ Enter. Close the new "File Explorer" window > close the GLFW window.
Download GLAD. If already you have downloaded it, it's okay. If not, right click on following address and select Open Link in New Window https://glad.dav1d.de/. In Language leave C/C++. In API/gl entry, select the latest version (today is 4.6). In Specification leave OpenGL. In Profile select Core. Ignore the Extensions. Make sure in Options list "Generate a loader" option is ticked. Scroll down the page and click GENERATE. In "Glad" window (see picture above), click "glad.zip". In downloading new File Explorer window you have two unzip folders: include and src. Open folder C:\GL\GLAD. Click folder include > click it again and drag into folder GLAD, at C:\GL\GLAD. Click folder src > click it again and drag into folder GLAD, at C:\GL\GLAD. Now in folder GLAD you have two unzip folders: include and src. Go back to GL folder. Close GLAD window > close downloading new File Explorer window.
Creating project for platform x64
Create empty project. If it's the first time you open Visual Studio. Click Create a new project. In Create a new project wizard, find Empty Project Start from scratch with C++ for Windows. Provides no starting files. (see image above, if necessary type Empty Project in search box above the list an hit ↵ Enter) > click it > click Next. In Configure your new project wizard for "Project name" type (or copy and paste) GLFWx64-GLAD-0 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. If it's not the first time. In main menu click File > New > Project… > the rest as above..
Add your Source file to the project. In "Solution Explorer" window right click the "Source Files" folder (the last one) > click "Add > "New Item…" In the "Add New Item" wizard, instead of "FileName", type Main > hit ↵ Enter. The source file Main.cpp opens in the main text editor but leave the file blank for now.
Add file glad.c. Go to Visual Studio > Solution Explorer > right click Source Files > click Add > Existing Item ... . Copy C:\GL\GLAD\src and paste in "Add Existing Item - GLFWx64-GLAD-0" wizard Address Bar > hit Enter > click glad.c. "File name" should be glad.c. Click Add.
Testing and Correcting project GLFWx64-GLAD-0
Test your project. Right click on following address and select Open Link in New Window https://learnopengl.com/code_viewer_gh.php?code=src/1.getting_started/2.1.hello_triangle/hello_triangle.cpp. Copy the code. Go to Visual Studio and paste in Main.cpp code area > in main menu select x64 > hit Ctr+F5 or in Visual Studio's main menu click the green triangle with phrase "Local Windows Debugger", and wait... Two windows should appear: One black and other with name "LearnOpenGL" and inside an orange triangle. If only the black window (the console) appears with message: "Failed to create GLFW window", set up is okay, function glfwCreateWindow did not work.
Correct errors if any. Files are missing. Copy GLFWx64-GLAD-0 and paste in File Explorer Address Bar. You should see file you added Main.cpp, and 4 other files added by Visual Studio. If they are missing you missed add file Main.cpp. Go to Part 7, step 5, and add it now. In "Error List" if you see error about file with extension .h Check whether folders GLFWx64 and GLAD exist in C:\GL. If they exist, go to previous Part, step 2, sub step 2. Additional Include Directories and follow instructions. file with extension .lib go to previous Part, step 2, sub step 3. Additional Library Directories, and follow instructions. Also to step 2, sub step 4. Additional Dependencies. file glad.c go to Part 7, step 6, and follow instructions. For other errors, if you cannot correct them, close Visual Studio > delete project folder GLFWx64-GLAD-0 which lives in C:\GLP > open Visual Studio > repeat set up from Part 7. Good job.
Creating Project with GLFWx64-GLAD-0 Template
Create Template. Go to Visual Studio main menu and, while GLFW64-GLAD-0 is open, click Project > Export Template... > in Choose Template Type, confirm "Project template" is selected. Click Next >. In Select Template Options, "Template name" should be GLFWx64-GLAD-0. Set Up SDL with Visual Studio 2017 Step 16 Version 2.jpg Click Finish. Template has been created. Close thrown window with template's path.
Create project. In Visual Studio main menu > Click "File" > "New" > "Project...". In Create a new project wizard in the list of templates select "GLFWx64-GLAD-0" (if necessary type it in search box above the list and hit ↵ Enter) > click Next. In Configure your new project wizard, "Project name" should be GLFWx64-GLAD-01. If Location is C:\GLP, it's okay. If it's not, copy C:\GLP, and paste. Be sure "Place solution and project in the same directory" is checked. Click Create, and wait till project be created. In Visual Studio's GUI main menu, select x64 > hit Ctrl+F5 or in Visual Studio's main menu click the green triangle with phrase "Local Windows Debugger". TIP. When you create project with this template remember in Visual Studio GUI's main menu select x64.
Installing CMake
Compiling a library from the source code guarantees that the resulting library is perfectly tailored for your CPU/OS, a luxury pre-compiled binaries don't always provide. It is also important that binaries you get target x64 platform.
Create folders GL and GLP. Open Windows's File Explorer > Navigate to disk (directory) C. If folders GL and GLP exist it's okay. If they do not, right click in empty area > select New > Folder > type GL > hit ↵ Enter. By same way create folder GLP.
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.29.2)", (or latest). In second "Platform" list (Binary distributions:), find (see image below) "Windows x64 ZIP" and click the beside entry cmake-3.29.2-windows-x86_64.zip (or latest). CMake 11.png
Copy and unzip the zip folder. Open folder C:\GL After folder "cmake-3.29.2-windows-x86_64" (or latest) has been downloaded and unzipped in the new File Explorer window, click it > click it again and drag into C:\GL. Once the folder has completed copying and pasting, copy CMake > click folder > right click > click "Rename" > Paste > hit ↵ Enter. Close the new "File Explorer" window > close the "CMake" window. Double click folder "CMake" > double click folder bin > inside you should see CMake's logo next to file name cmake-gui > double click this file. Now on your screen you have CMake GUI > go back to GL folder. Each time you need CMake, navigate to C:\ > GL > double click folder CMake > double click "bin" > double click file cmake-gui (the one with CMake's logo).
Downloading Source GLFW and binaries GLAD
Download GLFW source code. Right-click on following address and select Open Link in New Window https://www.glfw.org/download.html. Select "Source package". Open folder C:\GL After folder "glfw-3.4" has been downloaded and unzipped in the new File Explorer window, click it > click it again and drag into C:\GL. Once the folder has completed copying and pasting, copy GLFWsrc > click folder > right click > click "Rename" > Paste > hit ↵ Enter. Close the downloading new File Explorer window > close "GLFW" window.
Download GLAD. Right click on following address and select Open Link in New Window https://glad.dav1d.de/. In Language leave C/C++. Below API, in gl entry, select the latest version (today is 4.6). In Specification leave OpenGL. In Profile select Core. Ignore the Extensions. Make sure in Options list "Generate a loader" option is ticked. Click GENERATE. In "Glad" window (see picture above), click "glad.zip". In downloading new File Explorer window you have two unzip folders: include and src. Open folder C:\GL\GLAD. Click folder include > click it again and drag into folder GLAD, at C:\GL\GLAD. Click folder src > click it again and drag into folder GLAD, at C:\GL\GLAD. Now in folder GLAD you have two unzip folders: include and src. Go back to GL folder. Close GLAD window > close downloading new File Explorer window.
Creating Project GLFWsrc-GLAD-0
Create empty project. If it's the first time you open Visual Studio. Open it > click Create a new project. In Create a new project wizard, find Empty Project Start from scratch with C++ for Windows. Provides no starting files. (see image above, if necessary type Empty Project in search box above the list and hit ↵ Enter) > click it > click Next. In Configure your new project wizard for "Project name" type (or copy and paste) GLFWsrc-GLAD-0 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. If it's not the first time. In main menu click File > New > Project… > the rest as above..
Add your Source file to the project. In "Solution Explorer" window right click the "Source Files" folder (the last one) > click "Add > "New Item…" In the "Add New Item" wizard instead of "FileName" type Main > hit ↵ Enter. The source file Main.cpp opens in the main text editor but leave the file blank for now.
Add file glad.c. Go to Visual Studio > Solution Explorer > right click Source Files > click Add > Existing Item .... Copy C:\GL\GLAD\src and paste in "Add Existing Item - GLFWsrc-GLAD-0" wizard Address Bar > click glad.c. "File name" should be glad.c. Click Add. In Solution Explorer, below Source Files you should see two files: glad.c and Main.cpp.
Testing and Correcting project GLFWsrc-GLAD-0
Test your project. Right click on following address and select Open Link in New Window https://learnopengl.com/code_viewer_gh.php?code=src/1.getting_started/2.1.hello_triangle/hello_triangle.cpp. Copy the code. Go to Visual Studio and paste in Main.cpp code area > in main menu select x64 > hit Ctr+F5 or in Visual Studio's main menu click the green triangle with phrase "Local Windows Debugger", and wait... Two windows should appear: One black and other with name "LearnOpenGL" and inside an orange triangle. If only the black window (the console) appears with message: "Failed to create GLFW window", set up is okay, function glfwCreateWindow did not work.
Correct errors if any. Files are missing. Copy GLFWsrc-GLAD-0 and paste in File Explorer Address Bar. You should see file you added Main.cpp, and 4 other files added by Visual Studio. If they are missing you missed add file Main.cpp. Go to previous Part, step 6, and add it now. In "Error List" if you see error about file with extension .h Check whether folders GLFWsrc and GLAD exist in C:\GL. If they exist, go to previous Part, step 8, sub step 2. Include and follow instructions. file with extension .lib go to previous Part, step 8, sub step 3. Library, and follow instructions. Also to step 8 sub step 4. Dependencies. file glad.c go to previous Part, step 7, and follow instructions. For other errors, if you cannot correct them, close Visual Studio > delete project folder GLFWsrc-GLAD-0 which lives in C:\GLP > open Visual Studio > repeat set up from Part 11. Good job.
Creating Project with GLFWsrc-GLAD Template
Create Template. Go to Visual Studio main menu and, while GLFWsrc-GLAD-0 is open, click Project > Export Template.... On Export template Wizard check Project Template, if it's not checked. Click Next >. On Select Template Options, Template name should be GLFWsrc-GLAD-0 > click Finish. Template has been created. Close thrown window with template's path.
Create Project. In Visual Studio main menu click File > New > Project.... In Create a new project wizard in the list of templates select GLFWsrc-GLAD-0 (if necessary type it in search box above the list and hit ↵ Enter) > click Next. In Configure your new project wizard, "Project name" should be GLFWsrc-GLAD-01. If "Location" is C:\GLP it's okay. If it's not, copy and paste. Be sure Place solution and project in the same directory is checked. Click Create, and wait till project be created. In Visual Studio main menu, select x64. Hit Ctr+F5 or in Visual Studio's main menu click the green triangle with phrase "Local Windows Debugger". Good programming.
TIPS: In every project you create with it, remember, in Visual Studio's GUI, select x64 (next to Debug).
Comments
0 comment