VS2015 + openGL configuration
Steps for installing GLUT in Windows:
1, In C:\Program Files (x86)\ WindowKits \10\Include\10.0.10586.0\um\ GL or C:\Program Files (x86)\ WindowKits \8.1\Include\um\ GL there are GL.H and GLU.H;
The freeglut. J h, freeglut_ext. J h, freeglut_std. J h, glew. J h, glfw3. J h, glfw3native. J h, glut. J h, glxew. J h, wglew. J h, GLU. H and gl. H in C: \ Program Files \ Windows (x86) Kits 10 \ \ Include \ 10.0.10586.0 \ um \ gl or C: \ Program Files (x86) Kits \ Windows \ \ Include \ 8.1 um \ gl.
2, carry freeglut decompressed. Lib, glew32. Lib, glfw3dll. Lib, glu32. Lib, in the folder (C: \ Program Files \ Windows (x86) Kits 10 \ lib \ \ 10.0.10586.0 and, um, x86″
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\ UM \x64).
There were glu32.lib and opengl32.lib
3, carry freeglut decompressed. DLL, glew32. DLL, glfw3. The DLL into the operating system directory under the system32 folder. (Location: C:\Windows\System32)
If it is a 64-bit operating System, copy it to C:\Windows\System
Two VC engineering configuration:
1) Create a Win32 Console Application.
2) Link to OpenGL libraries. Right click on Project — property,
The Settings are as follows:
I’m going to put FreeGlut.Lib first; glew32.lib; glfw3dll.lib;
Add semicolons between libraries; Or the enter key
3) Modify the code as follows:
#include “stdafx.h”
// opg1.cpp : Defines the entry point for the console application.
//
#include “stdafx.h”
# include “stdafx. H”
# include & lt; GL/glew.h>
# include & lt; GL/glut.h>
# include & lt; math.h>
void display(void)
{
GlClear (GL_COLOR_BUFFER_BIT); /* Clear all pixels */
GlColor3f (1.0, 1.0, 1.0);
GlBegin (GL_POLYGON);// the draw white polygon
GlVertex3f (0.25, 0.25, 0.0);
GlVertex3f (0.75, 0.25, 0.0);
GlVertex3f (0.75, 0.75, 0.0);
GlVertex3f (0.25, 0.75, 0.0);
GlEnd ();
GlFlush (); /* Start processing buffered OpenGL routines */
}
void init (void)
{
GlclearColor (0.0, 0.0, 0.0, 0.0, 0.0); /* select clearing color */
GlMatrixMode (GL_PROJECTION);
GlLoadIdentity ();
GlOrtho (0.0, 1.0, 0.0, 1.0, -1.0, 1.0); /* Initialize viewing values */
}
int main(int argc, char** argv)
{
GlutInit (& amp; argc, argv);
GlutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
GlutInitWindowSize (250, 250); /*Declare initial window size.*/
GlutInitWindowPosition (100, 100); /*Declare initial window position.*/
GlutCreateWindow (” hello “); /*Open window with “hello”in its title bar.*/
The init (); /*Call initialization routines.*/
GlutDisplayFunc (display); /*Register callback function to display graphics.*/
GlutMainLoop (); /*Enter main loop and process events.*/
Return 0; /* ANSI C requires main to return int. */
}
The compile run displays a white rectangle
Steps for installing GLUT in Windows:
1, In C:\Program Files (x86)\ WindowKits \10\Include\10.0.10586.0\um\ GL or C:\Program Files (x86)\ WindowKits \8.1\Include\um\ GL there are GL.H and GLU.H;
The freeglut. J h, freeglut_ext. J h, freeglut_std. J h, glew. J h, glfw3. J h, glfw3native. J h, glut. J h, glxew. J h, wglew. J h, GLU. H and gl. H in C: \ Program Files \ Windows (x86) Kits 10 \ \ Include \ 10.0.10586.0 \ um \ gl or C: \ Program Files (x86) Kits \ Windows \ \ Include \ 8.1 um \ gl.
2, carry freeglut decompressed. Lib, glew32. Lib, glfw3dll. Lib, glu32. Lib, in the folder (C: \ Program Files \ Windows (x86) Kits 10 \ lib \ \ 10.0.10586.0 and, um, x86″
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\ UM \x64).
There were glu32.lib and opengl32.lib
3, carry freeglut decompressed. DLL, glew32. DLL, glfw3. The DLL into the operating system directory under the system32 folder. (Location: C:\Windows\System32)
If it is a 64-bit operating System, copy it to C:\Windows\System
Two VC engineering configuration:
1) Create a Win32 Console Application.
2) Link to OpenGL libraries. Right click on Project — property,
The Settings are as follows:
I’m going to put FreeGlut.Lib first; glew32.lib; glfw3dll.lib;
Add semicolons between libraries; Or the enter key
3) Modify the code as follows:
#include “stdafx.h”
// opg1.cpp : Defines the entry point for the console application.
//
#include “stdafx.h”
# include “stdafx. H”
# include & lt; GL/glew.h>
# include & lt; GL/glut.h>
# include & lt; math.h>
void display(void)
{
GlClear (GL_COLOR_BUFFER_BIT); /* Clear all pixels */
GlColor3f (1.0, 1.0, 1.0);
GlBegin (GL_POLYGON);// the draw white polygon
GlVertex3f (0.25, 0.25, 0.0);
GlVertex3f (0.75, 0.25, 0.0);
GlVertex3f (0.75, 0.75, 0.0);
GlVertex3f (0.25, 0.75, 0.0);
GlEnd ();
GlFlush (); /* Start processing buffered OpenGL routines */
}
void init (void)
{
GlclearColor (0.0, 0.0, 0.0, 0.0, 0.0); /* select clearing color */
GlMatrixMode (GL_PROJECTION);
GlLoadIdentity ();
GlOrtho (0.0, 1.0, 0.0, 1.0, -1.0, 1.0); /* Initialize viewing values */
}
int main(int argc, char** argv)
{
GlutInit (& amp; argc, argv);
GlutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
GlutInitWindowSize (250, 250); /*Declare initial window size.*/
GlutInitWindowPosition (100, 100); /*Declare initial window position.*/
GlutCreateWindow (” hello “); /*Open window with “hello”in its title bar.*/
The init (); /*Call initialization routines.*/
GlutDisplayFunc (display); /*Register callback function to display graphics.*/
GlutMainLoop (); /*Enter main loop and process events.*/
Return 0; /* ANSI C requires main to return int. */
}
The compile run displays a white rectangle