Hi,
While adding bindless textures support my program I run into an error when calling glGetTextureHandleARB
.
The gist of what I’m doing is
glGenTextures(1, &textureHandle);
glBindTexture(GL_TEXTURE_2D, textureHandle);
glTexImage2D(GL_TEXTURE_2D, MipMapLevel, DataFormat, TextureSize.x, TextureSize.y, 0, PixelFormat, DataType, TextureData);
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glBindTexture(GL_TEXTURE_2D, 0);
glGetTextureHandleARB(textureHandle);
I’m using GLAD to load the function’s addresses and I’ve checked the GL_ARB_bindless_texture
extension when generating GLAD. The video card itself supports the extension as well.
What is happening is that I’m getting the INVALID_OPERATION
(1282) error on the very first call to glGetTextureHandleARB
.
Subsequent calls return no error, so it looks like the extension is not loaded on the first call and the function address gets patched after it (?).
I’ve even replaced GLEW which I’ve used before with GLAD, thinking there is something wrong with GLEW’s extension loading.
Another thing that makes me think it’s somethig related to the address patching is the fact that when I try to run my program via RenderDoc, the RenderDoc crashes with Data Execution Prevention error, as if it was trying to execute some funky address.
Does anyone have an idea what might be wrong?