OpenGL FreeGlut in Visual Studio 2015

Starting an OpenGL project in VS 2015 is really easy, thanks to the NupenGL.Core nuget package.

Here are really quick steps to start your first OpenGL project using the FreeGlut library to provide a Window toolkit.

Open Visual Studio 2015 Community Edition and create a new Visual Studio C++ Windows Console Application.


Keep it simple. Choose an empty project template.


Install the NupenGL.Core nuget package. From Visual Studio, Go to Tools \ NuGet Package Manager \ Manage Nuget Packages for this solution. Search for “NupenGL” and install the package.


Add a new C or C++ file. Here is some sample code

#include <gl/freeglut.h>

void init();
void display(void);
void centerOnScreen();
void drawObject();

//  define the window position on screen
int window_x;
int window_y;

//  variables representing the window size
int window_width = 480;
int window_height = 480;

//  variable representing the window title
char *window_title = "Sample OpenGL FreeGlut App";

//  Program Main method.
void main(int argc, char **argv)
	//  Connect to the windowing system + create a window
	//  with the specified dimensions and position
	//  + set the display mode + specify the window title.
	glutInit(&amp;argc, argv);
	glutInitWindowSize(window_width, window_height);
	glutInitWindowPosition(window_x, window_y);
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);

	//  Set OpenGL program initial state.

	// Set the callback functions

	//  Start GLUT event processing loop

//  Set OpenGL program initial state.
void init()
	//  Set the frame buffer clear color to black. 
	glClearColor(0.0, 0.0, 0.0, 0.0);

//  This function is passed to glutDisplayFunc in order to display 
//	OpenGL contents on the window.
void display(void)
	//  Clear the window or more specifically the frame buffer...
	//  This happens by replacing all the contents of the frame
	//  buffer by the clear color (black in our case)

	//  Draw object

	//  Swap contents of backward and forward frame buffers

//  Draws our object.
void drawObject()
	//  Draw Icosahedron

//  This function sets the window x and y coordinates
//  such that the window becomes centered
void centerOnScreen()
	window_x = (glutGet(GLUT_SCREEN_WIDTH) - window_width) / 2;
	window_y = (glutGet(GLUT_SCREEN_HEIGHT) - window_height) / 2;

After this, you should be able to build and run without any issues. Your application should look something like this:


You can find a Visual Studio 2015 project that uses many of the FreeGlut features on this Github repository.

SharePoint CAML IntelliSense

So you’ve been having some pain trying to put IntelliSense into your frequent CAML (Collaborative Application Markup Language) files. For every new XML file you create, you have to go to its properties and then point to the target schema located at ../TEMPLATE/XML/wss.xsd.

If you don’t know what I mean, usually, in order to display IntelliSense in an XML file opened through Visual Studio, we must link the XML file to an XSD. This is done by going to the file properties and linking to the XSD every time we open the XML file in Visual Studio.

One way to avoid having to link to the XSD every time, is to add the file(s) to a Visual Studio project. However, what if you create CAML files so frequently that you don’t want to add them to a Visual Studio project every time?

The best solution would be to load the XSD whenever a new XML file referencing it is opened; and I have the steps to do that!

Under the Schemas folder of the Visual Studio installation folder (Ex: C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas), there is a file named Catalog.xml.

Reference wss.xsd from it by adding the following tag:

Make sure that href is pointing to the correct location of the wss.xsd file.

<Schema href="C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/12/TEMPLATE/XML/wss.xsd" targetNamespace="" />


Ali B