1
\$\begingroup\$

I know this is probably a popular question and can be very vague, so I'm going to be as specific as possible. I don't really know how to even form this question to be able to search Google, so I came here.

I've been following the tutorials from learnopengl.com and they have been by far the best explanations I've found on modern OpenGL anywhere. After I'm done with the tutorials, I'll be making a game. I have already started working on the game engine and it works just fine on Ubuntu and Mac OS X. Building the project is done with CMake (I've found this to be the easiest). The project uses GLFW and Glad as used in the tutorial. I can post the GitHub repo if you want.

Today I started trying to figure out how to get the project to run on Windows, but don't even know where to start. Hence coming here. I plan on using Visual Studio but haven't used it since college. How do I even start making the project? I've tried building GLFW on the machine and the building the project using CMake, but I get build tool errors that I don't know how to troubleshoot. Where do I begin?

\$\endgroup\$
  • \$\begingroup\$ I want to suggest to edit the question by adding what are the errors you are getting, and to avoid wording this as "What tools should I use?" and "Where do I begin?" which are off-topic. Between learnopengl and the khronos.org wiki you should have enough to get you started. You may also look for GitHub repos for refecence code. By the way, is it anything like this: OpenGL GLFW build errors OR linking errors? Edit: Also btw, khronos has good book selection. \$\endgroup\$ – Theraot May 5 '18 at 23:50
  • \$\begingroup\$ That question you linked is similar. Not quite working for me right now though. I'll keep digging and post more relevant info here shortly \$\endgroup\$ – David May 6 '18 at 0:07
  • \$\begingroup\$ Try it! learnopengl.com \$\endgroup\$ – Sveen May 6 '18 at 3:01
  • \$\begingroup\$ @Sveen I have been haha. I just figured out how to get it working. It has taken me since I posted it until now to figure it out. I should have an update to the question with more specifics to questions I still don't know the answers to \$\endgroup\$ – David May 6 '18 at 3:07
  • \$\begingroup\$ The title and the answer seem a bit far apart. You've only answered how to setup opengl. Could you edit the title/body so it's more fitting with the answer given? \$\endgroup\$ – Sidar May 6 '18 at 9:34
1
\$\begingroup\$

After a few hours of research and testing, I found a solution that works for me.

  1. In order to run my project on windows, the first thing you have to do is download glfw straight from the glfw homepage. Move the resulting directory into the libraries directory in the project and rename it to win_glfw. You also need the glfw binaries in a later step.

  2. Next, you need to build glfw with cmake (either the gui or the command line). The only thing you have to make sure is set correctly is the CMAKE_INSTALL_PREFIX. I set that to a folder in my directory. Others who have tried before failed if they didn't update this because it usually automatically defaults to somewhere in C:\Program Files which causes an access denied type of error.

  3. With the newly generated glfw folder in the project file, you have to build it from visual studio. I won't go into the details unless somebody really wants to know, but that's where it got really hairy.
  4. Next, all you have to do is generate the CMake files for the project, open the generated .sln file, build it, and be on your way.

There are alot of details I left out because, like I said, it just got really hairy. Thankfully, after building GLFW once, you don't have to do all this nonsense again. I'm sure I'll streamline everything moving forward, but at least now it's working.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.