Why is this simple OpenGL program via GLFW not working on Intel HD P4600?

1

I am trying to run one of the simplest OpenGL 3.3 programs one can ever run but it wouldn't run successfully. The program always returns with negative integer.

Here is how I got to this situation. I did nothing on my own but following this guide LearnOpenGL - Creating a window.

  1. I downloaded the latest source files of GLFW. Generated the GLFW project files from CMAKE GUI application for Visual Studio 2019 (I am using the free Community Edition though). Compiled the GLFW project files and got the glfw3.lib library file. No error whatsoever in this process. CMAKE showed this is for 64-bit build.
  2. Went over to GLAD web service website. Set Language = C/C++, Specification = OpenGL, API/GL = Version 3.3; everything else = none, Profile = Core. Then the website gave me the glad files(.h and .c files).
  3. Then I created a new C++ empty project. Included the location of header files (glfw3.h, glad.h) and location for GLFW library file (glfw3.lib) in the Project's properties's VC++ Directory. In linker -> Input, I added glfw3.lib and opengl32.lib.
  4. Added the glad.c file in project as suggested. Compiled this new OpenGL project. Everything works perfectly.
    There is no compilation error. There is no linking error.

Important notice: When you first build the program and then run it the first time, I can see the OpenGL window's opening but within a second it closes automatically; without any KB and/or Mouse interaction and then I get a negative integer as return in the console window. If I keep running the program again and again, I don't see that new UI Window again unless I rebuild it and then run it again.

When I use the debug, it invokes the following exception:
Exception Unhandled
Unhandled exception at 0x0000000010002203 (EZFRD64.dll) in opengl1.exe: 0xC0000005: Access violation reading location 0x00000000731A0090.

What wrong am I doing? Where did I go wrong?

Following is my system configuration:

CPU: Intel Xeon-E3 1246 v3 (This is Intel's 4th Geneartion/Haswell architecture),
GPU: Integrated Intel HD P4600/P4700 (basically it is Intel HD 4600 like all those 4th gen i5s and i7s have)
Latest Graphics Driver (Driver Date under Device Manager: 21-Jan-2020) has been installed.

"OpenGL Extension Viewer" is showing the following core feature support:
OpenGL 3.0: 100% support.
OpenGL 3.1: 100% support.
OpenGL 3.2: 100% support.
OpenGL 3.3: 100% support.
OpenGL 4.0: 100% support.
OpenGL 4.1: 100% support.
OpenGL 4.2: 100% support.
OpenGL 4.3: 100% support.
OpenGL 4.4: 80% support.
OpenGL 4.5: 18% support.
OpenGL 4.6: 9% support.
OpenGL ARB 2015: 8% support.

Following is the code I am trying to run:

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

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

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

int main()
{
    glfwInit();
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);

    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);

    if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
    {
        std::cout << "Failed to initialize GLAD" << std::endl;
        return -1;
    }

    while (!glfwWindowShouldClose(window))
    {
        glfwSwapBuffers(window);
        processInput(window);

        glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT);


        glfwPollEvents();
    }
    glfwTerminate();
    return 0;
}

void processInput(GLFWwindow* window)
{
    if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
        glfwSetWindowShouldClose(window, true);
}

void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
    glViewport(0, 0, width, height);
}
c++
opengl
visual-studio-2019
asked on Stack Overflow Apr 14, 2020 by falero80s

1 Answer

2

RE: that mysterious EZFRD64.dll, a post on Reddit:

According to google "EZFRD64.dll" mentioned there is a driver for some generic/off-brand "USB Vibration Controller" and appears to be known to cause issues at least on Windows 10.

See 1 2 3 and many more posts just on the first page of results for that dll.

Janky code running in/near the kernel can cause problems, film at 11 :)

answered on Stack Overflow Apr 14, 2020 by genpfault

User contributions licensed under CC BY-SA 3.0