Original Post
Hello, I am having some trouble with glTexImage2D. What happens is it segfaults every now and then (about 9 out of 10 times). This is what I am doing essentially:
GLuint ID;
char data[64*64];
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &ID);
glBindTexture(GL_TEXTURE_2D, ID);
// Segfault here -->
glTexImage2D(GL_TEXTURE_2D, 0, 4, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
// <--
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
...
I am checking for errors with glGetError() after glEnable, glGenTextures, and glBindTexture, and no errors turn up.
Could anyone provide any light as to what might cause the problem?
Thanks in advance.
GLuint ID;
char data[64*64];
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &ID);
glBindTexture(GL_TEXTURE_2D, ID);
// Segfault here -->
glTexImage2D(GL_TEXTURE_2D, 0, 4, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
// <--
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
...
I am checking for errors with glGetError() after glEnable, glGenTextures, and glBindTexture, and no errors turn up.
Could anyone provide any light as to what might cause the problem?
Thanks in advance.