Tag Archives: OpenGL

#During OpenGL development, fatal error C1083: can’t open include file: “GL / glut. H”: no such file or directory

During OpenGL development, fatal error C1083: can’t open include file: “GL/glut. H”: no such file or directory

I use vs2012 to write a simple OpenGL program, which always prompts when running:

Fatal error C1083: unable to open include file: “GL/glut. H”: no such file or directory;

Or fatal error C1083: cannot open include file: “GL/glaux. H”: no such file or directory;

At this time, the corresponding operations are as follows:

1. Download glut Toolkit: glut_ 37beta. Rar
2. Untie the downloaded compressed package and you will get five files, including glu32. Lib; glut32.dll,glut32.lib; Glut.dll, glut. H, glut. Lib
3. Put the extracted glut. H and glux. H in the folder C: program files (x86) and windows kits (8.0) and include (UM)( Note: the directory where each person installs vs is different, and the operation is based on the actual situation)
4. Put the extracted glut.lib, glut32.lib and glaux.lib in the static function library, which is located in the folder C: program files (x86) – Windows kits (8.0) – lib (win8) – um (x86)
5. If it still can’t work, put glut32.dll back to C: Windows/syswow64
6. Compile again. If there is still an error, change the original name of the header file # include & lt; GL/glut.h> Include & lt; glut.h>。
///

Download address of glut in Windows Environment: (about 150k in size)

http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip

This is the first article I saw when I configured the environment. Later, I made a mistake and used the method of this article to solve the problem https://www.pianshen.com/article/78231370291/

glCreateProgram error

Troubleshut< opengl>:

Problem Description:

Today, I encountered an OpenGL error. I doubted my life. The error report is as follows:
glcreateprogram() is a function in glew. I thought that the library connection was wrong. Then I connected all kinds of glew32.lib to the computer for a long time. By chance, I found that glew had no init and fainted…

Solution:

Execute before calling:
/* initialize glew. */
glewexperimental = GL_ TRUE;
GLenum err = glewInit();
if (err != GLEW_ OK)
{
std::cout << “Error initializing GLEW: ” << glewGetErrorString(err)
<< std::endl;
std::exit(EXIT_ FAILURE);
}

OpenGL programming error analysis


C :\ Program Files (x86)\ Microsoft Visual Studio 11.0\ VC \ Include \ GL \glew.h 84 1 consoleApplication8
Solution:
#if defined(__gl_h_) || defined(__GL_H__) || defined(__X_GL_H)
#error gl.h included before glew.h

#include <GL/glew.h>
#include <GL/glut.h>

Glew.h is written in front of GLUT.

error
1> ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is found in the function “void __cdecl init(void)” (?
1> init @@yaxxz)
1>; ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is found in the function “void __cdecl init(void)” (?
1> init @@yaxxz)
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewBindBuffer
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____ glewbufferData
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewGenBuffers
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewAttachShader
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____ glewcompileShader
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewCreateProgram
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewCreateShader
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewDeleteShader
1>; ConsoleApplication8. Obj: error LNK2001: cannot resolve the external symbol of __imp____glewEnableVertexAttribArray
1 & gt; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewGetProgramInfoLog
; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewGetProgramiv
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____ glewgetShaderInfolog
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewGetShaderiv
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewLinkProgram
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewShaderSource
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____glewUseProgram
1>; ConsoleApplication8.obj: error LNK2001: Unable to parse external symbol __imp____ glewvertexattribute
; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____ glewbindVertexArray
1>; ConsoleApplication8.obj: error LNK2001: Unable to resolve external symbol __imp____ glewGenvertexArrays
Solution:

#pragma comment(lib,"glew32.lib")

Error:

1> ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is referenced in function _main

1> ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is referenced in function _main

1> ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is referenced in function _main

1> ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is referenced in function _main

1> ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is referenced in function _main

1> ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is referenced in function _main

1> ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is displayed in the function “void __cdecl display(void)” (?Display @@yaxxz)

1> ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is referenced in function _main

1> ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is referenced in function _main

Solution:

#pragma comment(lib,"glut32.lib")

error:

1> ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is displayed in the function “void __cdecl display(void)” (?Display @@yaxxz) is referenced in
1> init @@yaxxz)
1>; ConsoleApplication8.obj: error LNK2019: Cannot resolve external symbol [email protected], which is displayed in the function “void __cdecl display(void)” (?Display @@yaxxz) is referenced in
1>; ConsoleApplication8.obj: error LNK2019: Unable to resolve external symbol [email protected], which is used in the function “void __cdecl initShader(char const *,char const *)” ([email protected]@[email protected]) is referenced
Solution:

#pragma comment(lib,"OpenGL32.lib")

After the vs2013 + OpenGL environment is set up, there is an error in running the first program

The computer reinstalled the secondary system, so I reconfigured the OpenGL environment. After the configuration is completed, I wrote an OpenGL program and found the following error message:

Solutions:
1. Add #define GLUT_DISABLE_ATEXIT_HACK before #include
2. Compile with Visual Studio 2012(V110) environment

Configuring OpenGL in Chinese version of VS2010 and problem solving

Under normal circumstances, the need to install first GLUT. Download address: http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\ GL “
2. Let the glut of decompression. Lib and glut32. Lib in “” Programfiles (x86) 10.0 VC \ \ lib \ Microsoft Visual studio” (ditto)
3.
4.
4.
5.
5.
5.
5.
5.
5.
5. Open VS2010, open any project or create a new one, and be careful to add.c to the file name when creating the CPP file (for example, opengl.c). Under the Solution ->; Right-click item ->; Property – & gt; Configure properties ->; Input – & gt; Add a dependency, where you add opengl32.lib; glu32.lib ; glut32 ;
 
Possible problems:
ERROR LNK1104: Could not open the file ‘opengl32.lib glu32.lib glut32.lib’
1. Note that these files are connected by semicolon, change to opengl32.lib; glu32.lib ; glut32 ;
2. The compiler did not find the path to these files, so you need to manually add: right-click project ->; Property – & gt; VC++ directory, in the include directory and library directory to add the path to store these files.
 
“Stdafx. h” : No such file or directory
1. Verify that the environment configuration is: Properties →C/C++→ Precompiled Header → “No Precompiled Header”.
#include < #include < stdafx.h> In general, except for MFC projects, precompiled headers are not used.
 
 

Glfw configuration

Download from GLFW
Download the 32-bit version

The file structure after decompression is as follows:

Copy the GLFW folder in include to VC/include in the VS installation directory

If you are using VS2013, copy the lib file from lib-vc2013 to VC/lib in the VS2013 installation directory
Then copy the DLL file from lib-vc2013 to system32 or system64

When writing a program, properties in the project ->; The linker – & gt; Input – & gt; Add glfw3.lib to the attached dependencies
#pragma comment(lib, “glfw3.lib”)

If it fails to start at runtime, then copy the DLL file in lib-vc2013 to the Debug/Release folder

Simple configuration of glfw + glad in vs2015 OpenGL development environment

A tutorial learning OpenGL reference is https://learnopengl-cn.github.io
this tutorial is based on GLFW (window) + glad (cross-platform), the following VS2015 a simple method of environment configuration:
1. New projects
Simply create an empty project and add a blank CPP file.
2. Add the Nupengl Core library
Add method: VS->; Tools – & gt; NUGET Package Manager -> Package management console
and then in the bottom of the Package management console input Install – Package nupengl. Enter the core instruction can
at this point, your this project has been configured glut GLFW glew
3. The configuration is glad
If you don’t need glad, you can skip this step, but glad is used in the tutorial above, so it should also be configured incidentally:

Open the Glad online service, set the Language to C/C++ and, from the API options, select OpenGL version 3.3 and above (we will use version 3.3 for this tutorial, but newer versions will work just fine). Generate
a
ader is selected. Generate
loader is selected. Generate
a
loader is selected. Ignore the Extensions for now (for now). When you have selected everything, click the Generate button to Generate the library files.

: Packages \nupengl. Core.0.1.0.1\build\native\include
: Packages \nupengl. Core.0.1.0.1\build\native\include

After these previous steps, the environment is actually configured
4. Test

#include <glad/glad.h>
#include <GLFW/glfw3.h>

#include <iostream>

void framebuffer_size_callback(GLFWwindow* window, int width, int height);
void processInput(GLFWwindow *window);

// settings
const unsigned int SCR_WIDTH = 800;
const unsigned int SCR_HEIGHT = 600;

int main()
{
    // glfw: initialize and configure
    // ------------------------------
    glfwInit();
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

#ifdef __APPLE__
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // uncomment this statement to fix compilation on OS X
#endif

    // glfw window creation
    // --------------------
    GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL);
    if (window == NULL)
    {
        std::cout << "Failed to create GLFW window" << std::endl;
        glfwTerminate();
        return -1;
    }
    glfwMakeContextCurrent(window);
    glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);

    // glad: load all OpenGL function pointers
    // ---------------------------------------
    if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
    {
        std::cout << "Failed to initialize GLAD" << std::endl;
        return -1;
    }    

    // render loop
    // -----------
    while (!glfwWindowShouldClose(window))
    {
        // input
        // -----
        processInput(window);

        // render
        // ------
        glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT);

        // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
        // -------------------------------------------------------------------------------
        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    // glfw: terminate, clearing all previously allocated GLFW resources.
    // ------------------------------------------------------------------
    glfwTerminate();
    return 0;
}

// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly
// ---------------------------------------------------------------------------------------------------------
void processInput(GLFWwindow *window)
{
    if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
        glfwSetWindowShouldClose(window, true);
}

// glfw: whenever the window size changed (by OS or user resize) this callback function executes
// ---------------------------------------------------------------------------------------------
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
    // make sure the viewport matches the new window dimensions; note that width and 
    // height will be significantly larger than specified on retina displays.
    glViewport(0, 0, width, height);
}

If the configuration is successful, a window like

Vs2015 configuring OpenGL (glfw, glew)

I was in charge of the model part, so I picked up the OpenGL I had learned before. By the way, I have been learning OpenGL in Xubuntu before
. Linux configuration programming environment is really quite convenient. Due to project reasons, have to Windows under the implementation of again. But the configuration environment feels more troublesome, so there is this article, just for the convenience of Xiaobai.

* VS2015
glfw
*>w
VS2015 Community Edition is free, easy to debug, the disadvantage is too big, but it is really the best IDE under Windows.
GLFW GLFW homepage can also use GLUT, just to feel a little bit new.
GLEW GLEW home page updated to version 2.0.


Set up project
Select the Win32 Console project and right-click on the solution ->;

ah select linker ->;
:
:>; Input is added in the additional dependencies OpenGL32. Lib, glfw32. Lib, glew32s. Lib

Here to say a bit, you can use glfw32dll. Lib, glew32. Lib. This requires the corresponding DLL to be placed in the project directory. However, if you select glew32.lib, many functions will not be linked, so it is recommended to choose glfw32s.lib.
Then look for a slightly more complicated program on the Internet

#include <iostream>

// GLEW
#define GLEW_STATIC
#include <GL/glew.h>

// GLFW
#include <GLFW/glfw3.h>


// Function prototypes
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);

// Window dimensions
const GLuint WIDTH = 800, HEIGHT = 600;

// Shaders
const GLchar* vertexShaderSource = "#version 330 core\n"
"layout (location = 0) in vec3 position;\n"
"void main()\n"
"{\n"
"gl_Position = vec4(position.x, position.y, position.z, 1.0);\n"
"}\0";
const GLchar* fragmentShader1Source = "#version 330 core\n"
"out vec4 color;\n"
"void main()\n"
"{\n"
"color = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n"
"}\n\0";
const GLchar* fragmentShader2Source = "#version 330 core\n"
"out vec4 color;\n"
"void main()\n"
"{\n"
"color = vec4(1.0f, 1.0f, 0.0f, 1.0f); // The color yellow \n"
"}\n\0";

// The MAIN function, from here we start the application and run the game loop
int main()
{
    // Init GLFW
    glfwInit();
    // Set all the required options for GLFW
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);

    // Create a GLFWwindow object that we can use for GLFW's functions
    GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "LearnOpenGL", nullptr, nullptr);
    glfwMakeContextCurrent(window);

    // Set the required callback functions
    glfwSetKeyCallback(window, key_callback);

    // Set this to true so GLEW knows to use a modern approach to retrieving function pointers and extensions
    glewExperimental = GL_TRUE;
    // Initialize GLEW to setup the OpenGL Function pointers
    glewInit();

    // Define the viewport dimensions
    int width, height;
    glfwGetFramebufferSize(window, &width, &height);
    glViewport(0, 0, width, height);


    // Build and compile the shader programs (we ignored compile log checks for readability (if you do encounter issues, add the compile-checks!))
    GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER);
    GLuint fragmentShaderOrange = glCreateShader(GL_FRAGMENT_SHADER); // The first fragment shader that outputs the color orange
    GLuint fragmentShaderYellow = glCreateShader(GL_FRAGMENT_SHADER); // The second fragment shader that outputs the color yellow
    GLuint shaderProgramOrange = glCreateProgram();
    GLuint shaderProgramYellow = glCreateProgram(); // The second shader program
    glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
    glCompileShader(vertexShader);
    glShaderSource(fragmentShaderOrange, 1, &fragmentShader1Source, NULL);
    glCompileShader(fragmentShaderOrange);
    glShaderSource(fragmentShaderYellow, 1, &fragmentShader2Source, NULL);
    glCompileShader(fragmentShaderYellow);
    // Link the first program object
    glAttachShader(shaderProgramOrange, vertexShader);
    glAttachShader(shaderProgramOrange, fragmentShaderOrange);
    glLinkProgram(shaderProgramOrange);
    // Then link the second program object using a different fragment shader (but same vertex shader) this time.
    // This is perfectly allowed since the inputs and outputs of both the vertex and fragment shaders are equally matched.
    glAttachShader(shaderProgramYellow, vertexShader);
    glAttachShader(shaderProgramYellow, fragmentShaderYellow);
    glLinkProgram(shaderProgramYellow);


    // Set up vertex data (and buffer(s)) and attribute pointers
    // We add a new set of vertices to form a second triangle (a total of 6 vertices); the vertex attribute configuration remains the same (still one 3-float position vector per vertex)
    GLfloat firstTriangle[] = {
        -0.9f, -0.5f, 0.0f,  // Left 
        -0.0f, -0.5f, 0.0f,  // Right
        -0.45f, 0.5f, 0.0f,  // Top 
    };
    GLfloat secondTriangle[] = {
        0.0f, -0.5f, 0.0f,  // Left
        0.9f, -0.5f, 0.0f,  // Right
        0.45f, 0.5f, 0.0f   // Top 
    };
    GLuint VBOs[2], VAOs[2];
    glGenVertexArrays(2, VAOs);
    glGenBuffers(2, VBOs);
    // ================================
    // First Triangle setup
    // ===============================
    glBindVertexArray(VAOs[0]);
    glBindBuffer(GL_ARRAY_BUFFER, VBOs[0]);
    glBufferData(GL_ARRAY_BUFFER, sizeof(firstTriangle), firstTriangle, GL_STATIC_DRAW);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), (GLvoid*)0);   // Vertex attributes stay the same
    glEnableVertexAttribArray(0);
    glBindVertexArray(0);
    // ================================
    // Second Triangle setup
    // ===============================
    glBindVertexArray(VAOs[1]); // Note that we bind to a different VAO now
    glBindBuffer(GL_ARRAY_BUFFER, VBOs[1]); // And a different VBO
    glBufferData(GL_ARRAY_BUFFER, sizeof(secondTriangle), secondTriangle, GL_STATIC_DRAW);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (GLvoid*)0); // Because the vertex data is tightly packed we can also specify 0 as the vertex attribute's stride to let OpenGL figure it out.
    glEnableVertexAttribArray(0);
    glBindVertexArray(0);

    // Game loop
    while (!glfwWindowShouldClose(window))
    {
        // Check if any events have been activiated (key pressed, mouse moved etc.) and call corresponding response functions
        glfwPollEvents();

        // Render
        // Clear the colorbuffer
        glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT);

        // Now when we want to draw the triangle we first use the vertex and orange fragment shader from the first program.
        glUseProgram(shaderProgramOrange);
        // Draw the first triangle using the data from our first VAO
        glBindVertexArray(VAOs[0]);
        glDrawArrays(GL_TRIANGLES, 0, 3);   // This call should output an orange triangle
                                            // Then we draw the second triangle using the data from the second VAO
                                            // When we draw the second triangle we want to use a different shader program so we switch to the shader program with our yellow fragment shader.
        glUseProgram(shaderProgramYellow);
        glBindVertexArray(VAOs[1]);
        glDrawArrays(GL_TRIANGLES, 0, 3);   // This call should output a yellow triangle
        glBindVertexArray(0);

        // Swap the screen buffers
        glfwSwapBuffers(window);
    }
    // Properly de-allocate all resources once they've outlived their purpose
    glDeleteVertexArrays(2, VAOs);
    glDeleteBuffers(2, VBOs);
    // Terminate GLFW, clearing any resources allocated by GLFW.
    glfwTerminate();
    return 0;
}

// Is called whenever a key is pressed/released via GLFW
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)
{
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
        glfwSetWindowShouldClose(window, GL_TRUE);
}

Configure OpenGL development environment (vs2015)

Configuring the OpenGL development environment (VS2015)
There are a lot of configuration VS + OpenGL tutorials online, for the configuration of the super treasure of the good and bad are mixed, mainly the official website did not give a good compiled library, many need to compile their own, so for beginners, it is difficult to configure successfully.
 
The following is a blog post that explains the configuration process and the rationale behind it
http://www.it165.net/pro/html/201504/38164.html
 
For beginners, everyone wants to be able to run the example given in the super bible. Here I directly give several twists and turns, all kinds of files generated after compilation, according to the following configuration can be run in VS2015 super treasure in the example, to achieve development.
 
I. Required allocation of resources

Resource download: http://download.csdn.net/download/ax_hacker/10107105
The zip package contains two folders, CJBD5_CODE and OpenGL. The former contains the sample program, and the latter is the three files required for configuration.
 
Include
Lib
Dll
 

How do I configure the development environment, as I explained in a previous blog post
http://blog.csdn.net/ax_hacker/article/details/78140003
The following is the configuration process for OpenGL.
 
1, Copy the files in the DLL folder to C:\Windows\ Syswow64 and C:\Windows\System32
 
2. Create an empty project, add a source file, and configure the project properties
 
1) Put the include from the previous folder under the include directory

 
2) lib in the library directory

 
3) Linker ->; Input – & gt; Additional dependencies freeglutd.lib; GLTools.lib; freeglut.lib; glew32s.lib

The simplest way to configure OpenGL development environment with vs2015

This method I think is the simplest!
Before I wrote this, I did a lot of research online on what to do with GLUT, GLEW, FreeGLUT, and what files to add to the site. Now I can tell you that VS2015 is so powerful that none of these operations are needed! VS has a tool called NuGet, which is a package manager for.NET. NuGet allows developers to create, share, and use libraries. We use OpenGL, which should be called libraries using OpenGL.
VS2015 steps to configure OpenGL. First, you need to have a project, and then add the OpenGL library to your project by clicking Project ->; Manage NuGet package, and then in a TAB, click on the “browse” input “NupenGL” into the search box, search will appear two libraries, we should both to our engineering to installation, after the success of the installation, you can find them in the installed base, in the right of the child window, you can learn about the installation of the library information.



It is not particularly easy to install GLUT, FreeGLUT, and GLEW libraries in just a few simple steps.
>
>
>
>
>
>
> I won’t post the source code.

You look at the picture below, is it time to put your heart at ease?

But again simple things, some people will still appear all kinds of problems. First of all, every time you create a new OpenGL project, you have to install a library. Some people hate this tedious, but I can’t help it. It won’t take you half a minute to install these two libraries, and you don’t have to do that on other computers. Also, turn off the 360, it’s so annoying!

On the configuration of OpenGL Red Book eighth edition environment in vs2013

I just started learning OpenGL, bought a copy of OpenGL Red Book 8,
The first example has been studied for a while and is finally ready to run. I wonder if there are any children’s shoes that have the same problem as me.
Here’s how I configured it:
First go to http://www.opengl-redbook.com/ and download the source code of the Little Red Book. Unzip it to get this

Then open VS2013 and create an empty Win32 console project.
Then right-click on the project properties and click on the VC ++ directory

Include directory – Edit and add the include folder in the Red Book source directory

Library directory – Edit and add the lib folder
in the Red Book source directory

Add and source files to the project, and paste the code from the first example of the Little Red Book

///
//
// triangles.cpp
//
///
#include <iostream>
using namespace std;
#include "vgl.h"
#include "LoadShaders.h"
enum VAO_IDs { Triangles, NumVAOs };
enum Buffer_IDs { ArrayBuffer, NumBuffers };
enum Attrib_IDs { vPosition = 0 };
GLuint VAOs[NumVAOs];
GLuint Buffers[NumBuffers];
const GLuint NumVertices = 6;
//---------------------------------------------------------------------
//
// init
//
void init(void)
{
	glGenVertexArrays(NumVAOs, VAOs);
	glBindVertexArray(VAOs[Triangles]);
	GLfloat vertices[NumVertices][2] = {
		{ -0.90, -0.90 }, // Triangle 1
		{ 0.85, -0.90 },
		{ -0.90, 0.85 },
		{ 0.90, -0.85 }, // Triangle 2
		{ 0.90, 0.90 },
		{ -0.85, 0.90 }
	};
	glGenBuffers(NumBuffers, Buffers);
	glBindBuffer(GL_ARRAY_BUFFER, Buffers[ArrayBuffer]);
	glBufferData(GL_ARRAY_BUFFER, sizeof(vertices),
		vertices, GL_STATIC_DRAW);
	ShaderInfo shaders[] = {
		{ GL_VERTEX_SHADER, "triangles.vert" },
		{ GL_FRAGMENT_SHADER, "triangles.frag" },
		{ GL_NONE, NULL }
	};
	GLuint program = LoadShaders(shaders);
	glUseProgram(program);
	glVertexAttribPointer(vPosition, 2, GL_FLOAT,
		GL_FALSE, 0, BUFFER_OFFSET(0));
	glEnableVertexAttribArray(vPosition);
}
//---------------------------------------------------------------------
//
// display
//
void display(void)
{
	glClear(GL_COLOR_BUFFER_BIT);
	glBindVertexArray(VAOs[Triangles]);
	glDrawArrays(GL_TRIANGLES, 0, NumVertices);
	glFlush();
}

//---------------------------------------------------------------------
//
// main
//
int main(int argc, char** argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGBA);
	glutInitWindowSize(512, 512);
	glutInitContextVersion(4, 3);
	glutInitContextProfile(GLUT_CORE_PROFILE);
	glutCreateWindow(argv[0]);
	if (glewInit()) {
		cerr << "Unable to initialize GLEW ... exiting" << endl;
		exit(EXIT_FAILURE);
	}
	init();
	glutDisplayFunc(display);
	glutMainLoop();
}

compile once found not through, will quote cannot resolve external command error,

This is because loadShaders.cpp could not be found
In the Little Red Book source directory there is a lib folder with LoadShaders
Right-click on the project’s source file to add an existing item

The libcmtd.lib library is in conflict with other libraries, so we can ignore it
Right-click on the project — Properties — Linker — Enter and add it in Ignore the specific default library

Now in the compilation once found can pass out

But it’s a white triangle, not a blue triangle, and you need to create two new texts in the project directory
Renamed Triangles. Vert and Triangles. Frag

The code is as follows:

triangles.vert

#version 430 core
layout(location = 0) in vec4 vPosition;
void
main()
{
	gl_Position = vPosition;
}

triangles.frag

#version 430 core
out vec4 fColor;
void
main()
{
	fColor = vec4(0.0, 0.0, 1.0, 1.0);
}

>
>