PDA

View Full Version : setting up opengl on visual studio



imsonoob
11-19-2017, 03:55 PM
I've been using the university linux system for my hw, but this hw is due during thanksgiving break and I'm having a hard time trying to setup opengl for visual studio 2017 on my windows machine. I've downloaded the source zip for glfw and compiled it using cmake. I got glew 2.10 the lastest binary from sourceforge website. I made a folder with call include and lib and added the headers of glew and glfw. I pasted the glew.dll file in my project folder. I did include the paths in my project properties and have the linker containing, opengl32.lib, glew32s.lib, glfw3.lib, glew32.lib. I'm also provided the compiled shader.vert and .frag and alt.vert and .frag and instructed to put into the project executable. That's the debug folder containing myprojectname application right? Visual studio complied successfully, but when I run it with crtl+f5, I get a blank window and 1 sec later it closes. Am I setting up right?

Dark Photon
11-19-2017, 07:11 PM
Visual studio complied successfully, but when I run it with crtl+f5, I get a blank window and 1 sec later it closes. Am I setting up right?

Open a command window, cd into your executable directory, and run your program from the command prompt. That'll let you see the output your program writes to stdout and stderr.

imsonoob
11-19-2017, 08:23 PM
Open a command window, cd into your executable directory, and run your program from the command prompt. That'll let you see the output your program writes to stdout and stderr.

It works in the command line, but I can't run it directly from visual studio?

john_connor
11-20-2017, 03:48 AM
I'm also provided the compiled shader.vert and .frag and alt.vert and .frag and instructed to put into the project executable.

what is more likely: those files are just source code



That's the debug folder containing myprojectname application right?

not necessarily, by default, visual studio does:

project folder\project name\...here your files...
project folder\Debug\project_name.exe

so if you put the shader files into project folder\project name\, you can run the app via crtl+f5, but if you double-click on the project folder\Debug\project_name.exe, those shader files need to be in that same folder.



Visual studio complied successfully, but when I run it with crtl+f5, I get a blank window and 1 sec later it closes. Am I setting up right?

because when hitting crtl+f5, the app starts, tries to find the shader, and likely cant find them, and terminates because of it ... just add a std::cin.get(); before returning 0 in your main.cpp to halt the app so you can see the error messages in the console before it terminates