glVertexAttribFormat fails with access violation - opengl

I have sources of some game. When I run this game it fails on function glVertexAttribFormat with error "Exception thrown at 0x00000000 in CSC3222.exe: 0xC0000005: Access violation executing location 0x00000000.".
With the help of the users of this site, I have found that this function was not loaded. This function is actually is function pointer and its value is null.
Why it is not loaded? How I can fix this problem?
I use glad loader.
OS: Windows 8.1
OpenGL version: 4.2

Sorry, I did not notice it earlier in my comment, but glVertexAttribFormat is OpenGL 4.3+ function link, so you need to use glad loader with that or higher version. It can be generated here glad

Related

MSVCP140.dll initialization failed

My application throws this error on the start
Unhandled exception at 0x00007FF8DC378C34 (msvcp140.dll) in TimexLPRService.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
In Stack Frame control I see msvcp140.dll!mtx_do_lock(_Mtx_internal_imp_t *mtx, const xtime *target)
const xtime *target is null (it shows in locals control)
If I start application manually it tells I have error on startup (error code 0xc0000142).
I have msvcp140.dll and vcruntime140.dll near the executable
I build my application with Visual Studio 2019 and vcpkg
I want to know how I can debug this problem to understand what went wrong or what possible causes of such problem
There can be different reasons.
#1 (update)
You may have a null pointer exception somewhere:
Access violation reading location 0x0000000000000000
To fix, try running your code using IDE's debugger, and it should break on the first access violation.
#2
The "MSVCP140.dll" name is shared between multiple versions, for example MSVC 2015 and MSVC 2019.
As long as the latest redist is installed, there should be no problems.
But crashs happen, for example if:
Your App was built with MSVC 2019.
But an older version is installed on the system (like 2015 redist).
Or, the correct redist is installed, but the wrong .dll version is placed beside your executable.

Access Violation on OpenGL functions, injected into existing context

I've been developing a hack for an older game adding shaders. The dll intercepts opengl calls and then modifies the rendering pipeline as needed. I use glew to load extension functions. For the first time, I am testing compiling and using the .dll on a computer different than the one I primarily developed on.
I've had a previous build of this dll that did work previously on this new machine, but now, when I've compiled the dll from a working source on this machine and attempt to use it, i receive access violations on many gl* function calls (glGenTextures, glBindTexture), that looks like:
Unhandled exception at 0x0C941CA3 in Game.exe: 0xC0000005: Access violation reading location 0xD8EBE92C. occurred
To initialize glew, I call glewInit when I intercept the first glSwapBuffers call. AFAIK this tells me the context already exists, and the gl calls are being called after this init step. I have attempted this with glewExperimental enabled as well. When i receive these errors, I have no indication that glew is not initializing correctly (glewInit() == GLEW_OK)
Am I missing something about OpenGL/glew availability between machines?
The primary development machine which it was working correctly on has a Nvidia Geforce GTX 660ti, running on Windows 10, compiling with VS2015
The secondary development machine which it is failing on, has a "AMD FirePro M6100 FireGL V", running on Windows 7, compiling with VS2017

Visual Studio 2013 Graphics Diagnostics throws immediate access violation in dxgi.dll

I am wanting to use Visual Studio's Graphics Diagnostics to debug some shader code, but when I try to "Start Diagnostics", I get an immediate access violation in dxgi.dll. This access violation appears to occur before my program's main function is even entered. I tried adding a Sleep just inside my WinMain function so I could attach a separate debugger, but this code was never hit. I opened one of the DirectX SDK sample programs with the same installation of VS2013 and the Graphics Diagnostics worked fine. I also tried using Graphics Diagnostics on my program on two separate PCs and they both threw the same access violation.
I suspect maybe it has something to do with my project configuration? It seems to be failing to establish a connection between the Graphics Diagnostics debugger and my program before the entry point of my program is called.
Any ideas are much appreciated!

Strange access violation on code exit

I am getting an access violation when my code exits. I am using Qt with Visual Studio 2010. The point where the access violation (0xC0000005) is thrown is on the last bracket, "}" of main. What would cause this?
All the call stack shows is "00d3d6c8()". That's it, nothing else. After web searching I saw some hints that it might be called by using release libraries instead of debug libraries for Qt, but as far as I know I am using the right libraries.
While using the Qt plugin for Visual Studio 2010, you can make a new Qt project, which automatically creates a static variable "ui" with which you can access all the Qt gui elements.
For some reason I had tried to change this to a pointer, and this ended up causing the problem. So I changed it back to a static reference and now my program exits without an access violation. Thanks for the help in the comments!

Debugging GLSL - NVIDIA Nsight causing errors - glslDevil will not work either

I'm having a difficult time trying to debug my GLSL shaders.
I have installed the 64-bit version of NVIDIA's Nsight but this causes problems.
Without running Nsight I now get the following error when trying to exit my application.
Unhandled exception at 0x77dd15de (ntdll.dll) in My.exe: 0xC0000005: Access violation reading location 0x6f637869.
I did not get errors of this type before installing Nsight. If I remove Nsight from my system then the errors no longer occur.
When I try and debug my .exe using Nsight in VS2010 (Nsight -> Start Graphics Debugging) then R6010 - abort() is called.
I'm running an 64-bit computer so I have to install the 64-bit version but I'm using 32-bit libraries for my OpenGL application.
As an alternative I have tried glslDevil.
The problem is with that is it gets stuck in an endless loop of wglGetExtensionsStringEXT() when I use Jump to next draw call (F7)
Can anyone help solve what might be the problem with either software solution, or possibly suggest an alternative? I would like to use either if possible but I have hit a brick wall with both.