I am trying to compile this application in VS13. I linked all the libraries this way: glew32.lib from glew-1.10.0 \ lib \ Release \ Win32 put glew32.dll in the same folder as Debug linked glfw3
When I run this code, it throws an exception in glTexImage3D; he says: "Access violation executing location 0x00000000."
#include <GL/glew.h>
#include <GL/glfw3.h>
#include <cstdlib>
#include <iostream>
GLenum volumeTexture;
int main() {
if (!glfwInit()) {
std::cerr << "Failed to initialize GLFW! I'm out!" << std::endl;
exit(-1);
}
glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
{
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
}
glClearColor(1, 0, 0, 1);
glGenTextures(1, &volumeTexture);
glBindTexture(GL_TEXTURE_3D, volumeTexture);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, 256, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
I noticed that the error resolves if I add
glTexImage3D = (PFNGLTEXIMAGE3DPROC) wglGetProcAddress("glTexImage3D");
but then I get the same exception later when I run glGenFramebuffers (I get it even if I comment out the glTexImage3D line) Am I linking something wrong?