Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: setting up opengl on visual studio

  1. #1
    Newbie Newbie
    Join Date
    Nov 2017
    Posts
    2

    setting up opengl on visual studio

    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?

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,173
    Quote Originally Posted by imsonoob View Post
    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.

  3. #3
    Newbie Newbie
    Join Date
    Nov 2017
    Posts
    2
    Quote Originally Posted by Dark Photon View Post
    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?

  4. #4
    Member Regular Contributor
    Join Date
    May 2016
    Posts
    445
    Quote Originally Posted by imsonoob View Post
    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


    Quote Originally Posted by imsonoob View Post
    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.


    Quote Originally Posted by imsonoob View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •