I’m following LearnOpenGL Tutorials here is my code i wrote while creating a window but it is throwing error on this line “while (!glfwWindowShouldClose(window)); {”
Here is the tutorial i was following https://youtu.be/z03LXhRBLGI?si=G4pj1pMfHFH4Zzb7
While following i got this error Access violation executing location 0x0000000000000000. OpenGL with GLAD and GLFW and checked out the code in answers and now I’m getting LearnOpenGL.exe has triggered a breakpoint. issue
#include<iostream>
#include<glad/glad.h>
#include<GLFW/glfw3.h>
using namespace std;
// framebuffer size callback function
void resize(GLFWwindow* window, int width, int height)
{
glViewport(0, 0, width, height);
}
void render(GLFWwindow* window) {
// here we put our rendering code
}
int main() {
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window = glfwCreateWindow(800, 800, "LearnOpenGL", NULL, NULL);
if (window = NULL) {
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
gladLoadGL();
//glViewport(0, 0, 800, 800);
//glClearColor(0.7f, 0.13f, 0.17f, 1.0f);
//glClear(GL_COLOR_BUFFER_BIT);
//glfwSwapBuffers(window);
glfwSetFramebufferSizeCallback(window, resize);
while (!glfwWindowShouldClose(window)); {
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.0f, 0.0f, 0.1f, 0.0f);
render(window);
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}
Output
'LearnOpenGL.exe' (Win32): Loaded 'C:UsersLearnOpenGLx64DebugLearnOpenGL.exe'. Symbols loaded.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32ntdll.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32kernel32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32KernelBase.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32user32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32win32u.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32gdi32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32gdi32full.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32msvcp_win.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32ucrtbase.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32shell32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32msvcp140d.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32vcruntime140d.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32vcruntime140_1d.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32ucrtbased.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32imm32.dll'.
The thread 0x8b38 has exited with code 0 (0x0).
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32dinput8.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32advapi32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32msvcrt.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32sechost.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32bcrypt.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32rpcrt4.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32XInput1_4.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32combase.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32cfgmgr32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32devobj.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32dwmapi.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32InputHost.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32CoreMessaging.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32SHCore.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32bcryptprimitives.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32cryptbase.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32uxtheme.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32msctf.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32opengl32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32glu32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32DXCore.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32kernel.appcore.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32clbcatq.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32AppXDeploymentClient.dll'.
'LearnOpenGL.exe' (Win32): Unloaded 'C:WindowsSystem32AppXDeploymentClient.dll'
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32DriverStoreFileRepositorynvamsi.inf_amd64_1d120d4dcaf3ccbfnvoglv64.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32setupapi.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32ole32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32oleaut32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32version.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32wtsapi32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32msasn1.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32cryptnet.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32crypt32.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32drvstore.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32wldp.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32wintrust.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32ntmarta.dll'.
The thread 0x7558 has exited with code 0 (0x0).
The thread 0x6d14 has exited with code 0 (0x0).
The thread 0xb07c has exited with code 0 (0x0).
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32imagehlp.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32cryptsp.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32rsaenh.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32DriverStoreFileRepositorynvamsi.inf_amd64_1d120d4dcaf3ccbfnvgpucomp64.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32windows.storage.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32WinTypes.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32shlwapi.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32nvspcap64.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32profapi.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32psapi.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32dbghelp.dll'.
'LearnOpenGL.exe' (Win32): Unloaded 'C:WindowsSystem32psapi.dll'
'LearnOpenGL.exe' (Win32): Unloaded 'C:WindowsSystem32dbghelp.dll'
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32psapi.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32dbghelp.dll'.
'LearnOpenGL.exe' (Win32): Unloaded 'C:WindowsSystem32psapi.dll'
'LearnOpenGL.exe' (Win32): Unloaded 'C:WindowsSystem32dbghelp.dll'
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32psapi.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32dbghelp.dll'.
'LearnOpenGL.exe' (Win32): Unloaded 'C:WindowsSystem32psapi.dll'
'LearnOpenGL.exe' (Win32): Unloaded 'C:WindowsSystem32dbghelp.dll'
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32psapi.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32dbghelp.dll'.
'LearnOpenGL.exe' (Win32): Unloaded 'C:WindowsSystem32psapi.dll'
'LearnOpenGL.exe' (Win32): Unloaded 'C:WindowsSystem32dbghelp.dll'
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32powrprof.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32umpdc.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32winsta.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32TextInputFramework.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32CoreUIComponents.dll'.
Debug Error!
Program: C:UsersLearnOpenGLx64DebugLearnOpenGL.exe
abort() has been called
(Press Retry to debug the application)
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32TextShaping.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32UIAutomationCore.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32ApplicationTargetedFeatureDatabase.dll'.
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32twinapi.appcore.dll'.
The thread 0x9e64 has exited with code 0 (0x0).
'LearnOpenGL.exe' (Win32): Loaded 'C:WindowsSystem32oleacc.dll'.
Exception thrown at 0x00007FFE0EC2FABC in LearnOpenGL.exe: Microsoft C++ exception: wil::ResultException at memory location 0x000000EC9E4FC8E0.
LearnOpenGL.exe has triggered a breakpoint.
I was expecting a window to pop
Sahil Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.