Sunday, December 13, 2015

Install OpenGL libraries with NuGet Package Manager

Actually, there is a better way to install OpenGL libraries in visual Studio 2013 Express Edition. Now only I got to realize that there is a tool, a powerful tool to do this - NuGet Package Manager. But one requirement for this powerful feature to function is that the project must first create in order to proceed to the download. The reason being is the libraries will be installed under the particular project's path. It wasn't installed under the Program Files.

When I first initiate the Package Manager Console, I was greeted by a welcome message:
Each package is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies.

Package Manager Console Host Version 2.8.60610.756

Type 'get-help NuGet' to see all available NuGet commands.

PM>
And then type in Install-Package nupengl.core. Once done, this should be seen:
PM> Install-Package nupengl.core
Attempting to resolve dependency 'nupengl.core.redist (≥ 0.1.0.1)'.
Installing 'nupengl.core.redist 0.1.0.1'.
Successfully installed 'nupengl.core.redist 0.1.0.1'.
Installing 'nupengl.core 0.1.0.1'.
Successfully installed 'nupengl.core 0.1.0.1'.
Adding 'nupengl.core.redist 0.1.0.1' to OpenGl1.
Successfully added 'nupengl.core.redist 0.1.0.1' to OpenGl1.
Adding 'nupengl.core 0.1.0.1' to OpenGl1.
Successfully added 'nupengl.core 0.1.0.1' to OpenGl1.

PM>
When I first use this feature, I didn't know the project shouldn't close. End up I got this error:
PM> Install-Package nupengl.core
Install-Package : The current environment doesn't have a solution open.
At line:1 char:16
+ Install-Package <<<<  nupengl.core
    + CategoryInfo          : InvalidOperation: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PowerShell.Commands.InstallPackageCommand
Ahhhh... so nice. This is far better than last time, everything was automated. Once I'm with done the installation, the first thing I do is to test the GL version installed in my machine:
int main(int argc, char** argv)
{
 ...

 glewInit();
 if (glewIsSupported("GL_VERSION_4_5"))
  std::cout << "GLEW version is 4.5" << std::endl;
 else
  std::cout << glGetString(GL_VERSION) << std::endl;

}
Unfortunately, I couldn't get my expected output. The output I got was 4.3.0 - Build 10.18.10.3995. Hmmm...

No comments: